You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by chua <ad...@ono.com> on 2006/08/25 11:32:11 UTC

building several jar files using maven-jar-plugin

Hello,

I have a maven1 project and I want to migrate it to maven2.
In maven2 doesn´t exist maven.xml and I have to do all the things that did
maven.xml using plugins.
My maven.xml did a war of the project but It did several things more. For
doing the same things as maven.xml I have to create a directory called
applet for my applets and into this directory I have to add:

- 3 jar files from /etc/applet_bin directory. That´s easy only doing:

<resource>
<targetPath>applet</targetPath>
<directory>${basedir}/etc/applet_bin</directory>
</resource>

- 1 jar file that I have to create from 3 properties files from
/etc/applet_text directory
- 1 more jar file (called editor.jar) with all compiled and all files from
/target/classes
- The last thing: I have to sign editor.jar

The first I did was to translate the part od maven.xml that did this using
maven-antrun-plugin and It works fine but I would want not to use ant
because I want a full migration.

Now, I´m using maven-jar-plugin:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>				
<executions>
<execution>
<id>making_applet_text</id>
<phase>process-classes</phase>
<configuration>
<jarName>applet_text</jarName>
<basedir>${basedir}/etc/applet_text</basedir>
<outputDirectory>${project.build.outputDirectory}/applet</outputDirectory>
</configuration>
<goals>
<goal>jar</goal>
</goals>
</execution>
<execution>
<id>making_editor</id>
<phase>process-classes</phase>						
<configuration>
<jarName>editor</jarName>
<basedir>${project.build.outputDirectory}</basedir>
<outputDirectory>${project.build.outputDirectory}/applet</outputDirectory>	
<excludes>								
<exclude>**/applet/**</exclude>
</excludes>
</configuration>
<goals>
<goal>jar</goal>
</goals>
</execution>
<execution>
<id>signing</id>
<phase>package</phase>
<configuration>
<jarName>editor</jarName>
<basedir>${project.build.outputDirectory}/applet</basedir>
<outputDirectory>${project.build.outputDirectory}/applet</outputDirectory>
<!--Options form signing the jar file-->
</configuration>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>

But first two jars are alwas jars composed by the compiled and filtered
files from target/classes directory (this is
${project.build.outputDirectory}) and the plugin signs the final war file
and it doesn´t sign the file I want (editor.jar).

I think the problem is that I don´t know how to say to pom.xml that the
files I want to pack in a jar file are in the location I want. I´ve written
<basedir>location<basedir> but it doesn´t work.

Any idea?

Thanks and sorry for the lenght.

-- 
View this message in context: http://www.nabble.com/building-several-jar-files-using-maven-jar-plugin-tf2163705.html#a5980275
Sent from the Maven - Users forum at Nabble.com.


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


Re: building several jar files using maven-jar-plugin

Posted by chua <ad...@ono.com>.
Thanks for the help!

Now I use modules to build several jars. More or less you should have a
module for each m1 jar goal from maven.xml.

that´s the way for not using maven-antrun-plugin. Finally I get a full
migration.

Thanks again!
-- 
View this message in context: http://www.nabble.com/building-several-jar-files-using-maven-jar-plugin-tf2163705.html#a6074549
Sent from the Maven - Users forum at Nabble.com.


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


Re: building several jar files using maven-jar-plugin

Posted by Geoffrey De Smet <ge...@gmail.com>.
There's a guide on "using maven when you can't use the conventions" or 
something that explains one way to do this:
basically create a different pom.xml for each jar and let them use 
common directory's.

chua wrote, On 2006-08-25 11:32 AM:
> Hello,
> 
> I have a maven1 project and I want to migrate it to maven2.
> In maven2 doesn´t exist maven.xml and I have to do all the things that did
> maven.xml using plugins.
> My maven.xml did a war of the project but It did several things more. For
> doing the same things as maven.xml I have to create a directory called
> applet for my applets and into this directory I have to add:
> 
> - 3 jar files from /etc/applet_bin directory. That´s easy only doing:
> 
> <resource>
> <targetPath>applet</targetPath>
> <directory>${basedir}/etc/applet_bin</directory>
> </resource>
> 
> - 1 jar file that I have to create from 3 properties files from
> /etc/applet_text directory
> - 1 more jar file (called editor.jar) with all compiled and all files from
> /target/classes
> - The last thing: I have to sign editor.jar
> 
> The first I did was to translate the part od maven.xml that did this using
> maven-antrun-plugin and It works fine but I would want not to use ant
> because I want a full migration.
> 
> Now, I´m using maven-jar-plugin:
> 
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-jar-plugin</artifactId>				
> <executions>
> <execution>
> <id>making_applet_text</id>
> <phase>process-classes</phase>
> <configuration>
> <jarName>applet_text</jarName>
> <basedir>${basedir}/etc/applet_text</basedir>
> <outputDirectory>${project.build.outputDirectory}/applet</outputDirectory>
> </configuration>
> <goals>
> <goal>jar</goal>
> </goals>
> </execution>
> <execution>
> <id>making_editor</id>
> <phase>process-classes</phase>						
> <configuration>
> <jarName>editor</jarName>
> <basedir>${project.build.outputDirectory}</basedir>
> <outputDirectory>${project.build.outputDirectory}/applet</outputDirectory>	
> <excludes>								
> <exclude>**/applet/**</exclude>
> </excludes>
> </configuration>
> <goals>
> <goal>jar</goal>
> </goals>
> </execution>
> <execution>
> <id>signing</id>
> <phase>package</phase>
> <configuration>
> <jarName>editor</jarName>
> <basedir>${project.build.outputDirectory}/applet</basedir>
> <outputDirectory>${project.build.outputDirectory}/applet</outputDirectory>
> <!--Options form signing the jar file-->
> </configuration>
> <goals>
> <goal>sign</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> 
> But first two jars are alwas jars composed by the compiled and filtered
> files from target/classes directory (this is
> ${project.build.outputDirectory}) and the plugin signs the final war file
> and it doesn´t sign the file I want (editor.jar).
> 
> I think the problem is that I don´t know how to say to pom.xml that the
> files I want to pack in a jar file are in the location I want. I´ve written
> <basedir>location<basedir> but it doesn´t work.
> 
> Any idea?
> 
> Thanks and sorry for the lenght.
> 

-- 
With kind regards,
Geoffrey De Smet


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