You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dan Tran <da...@gmail.com> on 2007/10/04 05:24:43 UTC

Re: M2: how to create jni .jar & .so file from same pom.xml

force maven-compiler-plugin and maven-jar-plugin to compile and
package your java classes at 'initialize' phase, and then
native-maven-plugin will take over.

then you  will need build-helper-maven-plugin to attach you jar for deployment.

-D

On 10/3/07, Joe Argiro <ja...@idttechnology.com> wrote:
> Hi
>
> I attempting to migrate from  maven to maven2.
>
> I have an existing project which creates a jar file and  a corresponding
> .so file
> I'd like to be avoid changing the existing directory structure  which looks
> like
>
> project  - (pom.xml )
> project/src/java  - (*.java)
> project/src/unix   - (*.c *.h)
>
>
> the pom.xml is below
> if I set the <packaging>  to  jar.  it creates the jar file
> if I set it to .so  it creates the .so file
>
> how do i get it to do both at the same time
>
> thanks!
> --joe
>
>
> -------------------------------------
> pom.xml -----------------------------------------
>
> <project>
>   <groupId>app</groupId>
>   <artifactId>app1</artifactId>
>   <packaging>jar</packaging>
>   <!-- packaging>so</packaging -->
>   <version>9.3</version>
>  <properties>
>     <compilerStartOptions>-g -fPIC</compilerStartOptions>
>     <linkerStartOptions>-g -fPIC -mimpure-text -shared</linkerStartOptions>
>
>
>
>
> <linkerEndOptions>-L/usr/lib/shared -lboost_signals-gcc -lboost_thread-gcc-m
> t -lsocket -lnsl -lresolv</linkerEndOptions>
>  </properties>
>   <build>
>     <defaultGoal>install</defaultGoal>
>     <sourceDirectory>src/java</sourceDirectory>
>     <testSourceDirectory>src/test/java</testSourceDirectory>
>     <plugins>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-jar-plugin</artifactId>
>       </plugin>
>       <plugin>
>         <groupId>org.codehaus.mojo</groupId>
>         <artifactId>native-maven-plugin</artifactId>
>         <extensions>true</extensions>
>         <configuration>
>           <compilerStartOptions>
>
> <compilerStartOption>${compilerStartOptions}</compilerStartOption>
>           </compilerStartOptions>
>           <sources>
>             <source>
>               <directory>src/unix</directory>
>               <includes>
>                 <include>*.c</include>
>               </includes>
>             </source>
>             <source>
>               <directory>src/unix</directory>
>             </source>
>           </sources>
>           <linkerStartOptions>
>             <linkerStartOption>${linkerStartOptions}</linkerStartOption>
>           </linkerStartOptions>
>           <linkerEndOptions>
>             <linkerEndOption>${linkerEndOptions}</linkerEndOption>
>           </linkerEndOptions>
>         </configuration>
>         <executions>
>           <execution>
>             <id>javah</id>
>             <phase>generate-sources</phase>
>             <configuration>
>             <verbose>true</verbose>
>               <classNames>
>                 <className>class1</className>
>                 <className>class2</className>
>               </classNames>
>            </configuration>
>             <goals>
>               <goal>javah</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>
>   </build>
> </project>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: M2: how to create jni .jar & .so file from same pom.xml

Posted by Joseph Argiro <ja...@idttechnology.com>.
thanks dan

worked on the first try!!

--joe

Dan Tran wrote:
> I just cooked one up
>
> http://svn.codehaus.org/mojo/trunk/mojo/maven-native/native-maven-plugin/src/it/jni/java-win32/
>
> -D
>
>
>
> On 10/3/07, Joe Argiro <ja...@idttechnology.com> wrote:
>   
>> Dan
>>
>> I'm new to maven2... i tried adding phase to the compile & jar plugins
>> but can't get it to work
>>
>> could you give me an example
>>
>> thanks!
>> --joe
>>
>> ----- Original Message -----
>> From: "Dan Tran" <da...@gmail.com>
>> To: "Maven Users List" <us...@maven.apache.org>
>> Sent: Wednesday, October 03, 2007 11:24 PM
>> Subject: Re: M2: how to create jni .jar & .so file from same pom.xml
>>
>>
>>     
>>> force maven-compiler-plugin and maven-jar-plugin to compile and
>>> package your java classes at 'initialize' phase, and then
>>> native-maven-plugin will take over.
>>>
>>> then you  will need build-helper-maven-plugin to attach you jar for
>>>       
>> deployment.
>>     
>>> -D
>>>
>>> On 10/3/07, Joe Argiro <ja...@idttechnology.com> wrote:
>>>       
>>>> Hi
>>>>
>>>> I attempting to migrate from  maven to maven2.
>>>>
>>>> I have an existing project which creates a jar file and  a corresponding
>>>> .so file
>>>> I'd like to be avoid changing the existing directory structure  which
>>>>         
>> looks
>>     
>>>> like
>>>>
>>>> project  - (pom.xml )
>>>> project/src/java  - (*.java)
>>>> project/src/unix   - (*.c *.h)
>>>>
>>>>
>>>> the pom.xml is below
>>>> if I set the <packaging>  to  jar.  it creates the jar file
>>>> if I set it to .so  it creates the .so file
>>>>
>>>> how do i get it to do both at the same time
>>>>
>>>> thanks!
>>>> --joe
>>>>
>>>>
>>>> -------------------------------------
>>>> pom.xml -----------------------------------------
>>>>
>>>> <project>
>>>>   <groupId>app</groupId>
>>>>   <artifactId>app1</artifactId>
>>>>   <packaging>jar</packaging>
>>>>   <!-- packaging>so</packaging -->
>>>>   <version>9.3</version>
>>>>  <properties>
>>>>     <compilerStartOptions>-g -fPIC</compilerStartOptions>
>>>>
>>>>         
>>    <linkerStartOptions>-g -fPIC -mimpure-text -shared</linkerStartOptions>
>>     
>>>>
>>>>
>>>>
>>>>         
>> <linkerEndOptions>-L/usr/lib/shared -lboost_signals-gcc -lboost_thread-gcc-m
>>     
>>>> t -lsocket -lnsl -lresolv</linkerEndOptions>
>>>>  </properties>
>>>>   <build>
>>>>     <defaultGoal>install</defaultGoal>
>>>>     <sourceDirectory>src/java</sourceDirectory>
>>>>     <testSourceDirectory>src/test/java</testSourceDirectory>
>>>>     <plugins>
>>>>       <plugin>
>>>>         <groupId>org.apache.maven.plugins</groupId>
>>>>         <artifactId>maven-jar-plugin</artifactId>
>>>>       </plugin>
>>>>       <plugin>
>>>>         <groupId>org.codehaus.mojo</groupId>
>>>>         <artifactId>native-maven-plugin</artifactId>
>>>>         <extensions>true</extensions>
>>>>         <configuration>
>>>>           <compilerStartOptions>
>>>>
>>>> <compilerStartOption>${compilerStartOptions}</compilerStartOption>
>>>>           </compilerStartOptions>
>>>>           <sources>
>>>>             <source>
>>>>               <directory>src/unix</directory>
>>>>               <includes>
>>>>                 <include>*.c</include>
>>>>               </includes>
>>>>             </source>
>>>>             <source>
>>>>               <directory>src/unix</directory>
>>>>             </source>
>>>>           </sources>
>>>>           <linkerStartOptions>
>>>>             <linkerStartOption>${linkerStartOptions}</linkerStartOption>
>>>>           </linkerStartOptions>
>>>>           <linkerEndOptions>
>>>>             <linkerEndOption>${linkerEndOptions}</linkerEndOption>
>>>>           </linkerEndOptions>
>>>>         </configuration>
>>>>         <executions>
>>>>           <execution>
>>>>             <id>javah</id>
>>>>             <phase>generate-sources</phase>
>>>>             <configuration>
>>>>             <verbose>true</verbose>
>>>>               <classNames>
>>>>                 <className>class1</className>
>>>>                 <className>class2</className>
>>>>               </classNames>
>>>>            </configuration>
>>>>             <goals>
>>>>               <goal>javah</goal>
>>>>             </goals>
>>>>           </execution>
>>>>         </executions>
>>>>       </plugin>
>>>>   </build>
>>>> </project>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>       
>>     

-- 

------------------------------------------------------
Joseph Argiro
Phone: 1-973-438-5736
Email: jargiro@idttechnology.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: M2: how to create jni .jar & .so file from same pom.xml

Posted by Joe Argiro <ja...@idttechnology.com>.
Dan

I'm new to maven2... i tried adding phase to the compile & jar plugins
but can't get it to work

could you give me an example

thanks!
--joe

----- Original Message ----- 
From: "Dan Tran" <da...@gmail.com>
To: "Maven Users List" <us...@maven.apache.org>
Sent: Wednesday, October 03, 2007 11:24 PM
Subject: Re: M2: how to create jni .jar & .so file from same pom.xml


> force maven-compiler-plugin and maven-jar-plugin to compile and
> package your java classes at 'initialize' phase, and then
> native-maven-plugin will take over.
>
> then you  will need build-helper-maven-plugin to attach you jar for
deployment.
>
> -D
>
> On 10/3/07, Joe Argiro <ja...@idttechnology.com> wrote:
> > Hi
> >
> > I attempting to migrate from  maven to maven2.
> >
> > I have an existing project which creates a jar file and  a corresponding
> > .so file
> > I'd like to be avoid changing the existing directory structure  which
looks
> > like
> >
> > project  - (pom.xml )
> > project/src/java  - (*.java)
> > project/src/unix   - (*.c *.h)
> >
> >
> > the pom.xml is below
> > if I set the <packaging>  to  jar.  it creates the jar file
> > if I set it to .so  it creates the .so file
> >
> > how do i get it to do both at the same time
> >
> > thanks!
> > --joe
> >
> >
> > -------------------------------------
> > pom.xml -----------------------------------------
> >
> > <project>
> >   <groupId>app</groupId>
> >   <artifactId>app1</artifactId>
> >   <packaging>jar</packaging>
> >   <!-- packaging>so</packaging -->
> >   <version>9.3</version>
> >  <properties>
> >     <compilerStartOptions>-g -fPIC</compilerStartOptions>
> >
    <linkerStartOptions>-g -fPIC -mimpure-text -shared</linkerStartOptions>
> >
> >
> >
> >
> >
<linkerEndOptions>-L/usr/lib/shared -lboost_signals-gcc -lboost_thread-gcc-m
> > t -lsocket -lnsl -lresolv</linkerEndOptions>
> >  </properties>
> >   <build>
> >     <defaultGoal>install</defaultGoal>
> >     <sourceDirectory>src/java</sourceDirectory>
> >     <testSourceDirectory>src/test/java</testSourceDirectory>
> >     <plugins>
> >       <plugin>
> >         <groupId>org.apache.maven.plugins</groupId>
> >         <artifactId>maven-jar-plugin</artifactId>
> >       </plugin>
> >       <plugin>
> >         <groupId>org.codehaus.mojo</groupId>
> >         <artifactId>native-maven-plugin</artifactId>
> >         <extensions>true</extensions>
> >         <configuration>
> >           <compilerStartOptions>
> >
> > <compilerStartOption>${compilerStartOptions}</compilerStartOption>
> >           </compilerStartOptions>
> >           <sources>
> >             <source>
> >               <directory>src/unix</directory>
> >               <includes>
> >                 <include>*.c</include>
> >               </includes>
> >             </source>
> >             <source>
> >               <directory>src/unix</directory>
> >             </source>
> >           </sources>
> >           <linkerStartOptions>
> >             <linkerStartOption>${linkerStartOptions}</linkerStartOption>
> >           </linkerStartOptions>
> >           <linkerEndOptions>
> >             <linkerEndOption>${linkerEndOptions}</linkerEndOption>
> >           </linkerEndOptions>
> >         </configuration>
> >         <executions>
> >           <execution>
> >             <id>javah</id>
> >             <phase>generate-sources</phase>
> >             <configuration>
> >             <verbose>true</verbose>
> >               <classNames>
> >                 <className>class1</className>
> >                 <className>class2</className>
> >               </classNames>
> >            </configuration>
> >             <goals>
> >               <goal>javah</goal>
> >             </goals>
> >           </execution>
> >         </executions>
> >       </plugin>
> >   </build>
> > </project>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org