You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ron Wheeler <rw...@artifact-software.com> on 2010/06/28 22:12:04 UTC
Building a tar and zip of jars from other projects
I am trying to build a pom in its own project that will assemble a tar
file and a zip file that will contain all of the jar files that we build
that need to go into the tomcat/lib directory.
I am missing 2 things.
1) What do I say to tell the maven-assembly-plugin that I want a tar and
a zip built?
2) How to I tell the maven-assembly-plugin that I want the jar files
zipped up without the contents being extracted and zipped as individual
classes?
I have built a test pom shown below.
Since it has
<descriptorRef>
jar-with-dependencies
</descriptorRef>
it restructures the internal jar contents rather than creating a tar of
jar files.
I did find a nice article from Sonatype but these questions remain.
Ron
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.artifact_software.lms</groupId>
<artifactId>lms-pom-master</artifactId>
<version>1.8.3-SNAPSHOT</version>
</parent>
<groupId>com.artifact_software.lms</groupId>
<artifactId>lms-deployment-jars</artifactId>
<version>1.8.3-SNAPSHOT</version>
<packaging>pom</packaging>
<description>Artifact LMS Portal Shared Library Archive
builder.</description>
<name>lms-deploymentjars</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.artifact_software.lms</groupId>
<artifactId>lms-pom-spring-hibernate-mysql-tomcat</artifactId>
<version>${lms-project.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.artifact_software.lms</groupId>
<artifactId>lms-pom-jsf</artifactId>
<version>${lms-project.version}</version>
<type>pom</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-2</version>
<executions>
<execution>
<id>create-jar-deployment-archive</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptorRefs>
<descriptorRef>
jar-with-dependencies
</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Building a tar and zip of jars from other projects
Posted by Marshall Schor <ms...@schor.com>.
On 6/28/2010 6:39 PM, Ron Wheeler wrote:
> Thanks for the quick reply. See below.
>
> On 28/06/2010 4:37 PM, Marshall Schor wrote:
>>
>> On 6/28/2010 4:12 PM, Ron Wheeler wrote:
>>
>>> I am trying to build a pom in its own project that will assemble a tar
>>> file and a zip file that will contain all of the jar files that we
>>> build that need to go into the tomcat/lib directory.
>>>
>>>
>>> I am missing 2 things.
>>> 1) What do I say to tell the maven-assembly-plugin that I want a tar
>>> and a zip built?
>>>
>> There are two ways to configure the assembly plugin - one uses
>> "predefined" descriptors, the other lets you specify specific
>> instructions in a descriptor of your own that you point to - use the
>> parameter<descriptors> instead of<descriptorRefs>.
>>
>>
> Where are the "predefined descriptors" documented?
See
http://www.sonatype.com/books/mvnref-book/reference/assemblies-sect-basics.html#assemblies-sect-predefined
Also see
http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html
>> Then write your own assembly descriptor.
> Do I need to write my own?
Yes, I think so.
>> See
>> http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html for
>> instructions on how to do this. You'll see an element<formats> where
>> you can specify the tar and zip formats.
>>
>>
>>> 2) How to I tell the maven-assembly-plugin that I want the jar files
>>> zipped up without the contents being extracted and zipped as
>>> individual classes?
>>>
>> In the custom assembly descriptor you make, you can control this using
>> the<unpack> option, see the details in the above documentation.
>>
>> For a book chapter on how to do all kinds of things with assemblies,
>> see:
>> http://www.sonatype.com/books/mvnref-book/reference/assemblies.html
>>
>>
> Unpack seems to be too late. Once you merge the jars, I don't see how
> you can reconstruct the jars during the unpack.
Sorry, I meant to suggest you use the <unpack>false</unpack> setting, to
prevent the Jars from being unpacked. According to the documentation,
this is the default - so maybe it will do just what you want by default :-)
-Marshall Schor
>
> Ron
>> -Marshall Schor
>>
>>
>>
>>
>>
>>> I have built a test pom shown below.
>>> Since it has
>>> <descriptorRef>
>>> jar-with-dependencies
>>> </descriptorRef>
>>> it restructures the internal jar contents rather than creating a tar
>>> of jar files.
>>>
>>> I did find a nice article from Sonatype but these questions remain.
>>> Ron
>>>
>>>
>>>
>>> <project xmlns="http://maven.apache.org/POM/4.0.0"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>>> http://maven.apache.org/xsd/maven-4.0.0.xsd">
>>> <modelVersion>4.0.0</modelVersion>
>>> <parent>
>>> <groupId>com.artifact_software.lms</groupId>
>>> <artifactId>lms-pom-master</artifactId>
>>> <version>1.8.3-SNAPSHOT</version>
>>> </parent>
>>>
>>> <groupId>com.artifact_software.lms</groupId>
>>> <artifactId>lms-deployment-jars</artifactId>
>>> <version>1.8.3-SNAPSHOT</version>
>>> <packaging>pom</packaging>
>>> <description>Artifact LMS Portal Shared Library Archive
>>> builder.</description>
>>>
>>> <name>lms-deploymentjars</name>
>>>
>>> <properties>
>>> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>>> </properties>
>>>
>>> <dependencies>
>>> <dependency>
>>> <groupId>com.artifact_software.lms</groupId>
>>> <artifactId>lms-pom-spring-hibernate-mysql-tomcat</artifactId>
>>> <version>${lms-project.version}</version>
>>> <type>pom</type>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.artifact_software.lms</groupId>
>>> <artifactId>lms-pom-jsf</artifactId>
>>> <version>${lms-project.version}</version>
>>> <type>pom</type>
>>> </dependency>
>>> </dependencies>
>>> <build>
>>> <plugins>
>>> <plugin>
>>> <artifactId>maven-assembly-plugin</artifactId>
>>> <version>2.2-beta-2</version>
>>> <executions>
>>> <execution>
>>> <id>create-jar-deployment-archive</id>
>>> <phase>package</phase>
>>> <goals>
>>> <goal>single</goal>
>>> </goals>
>>> <configuration>
>>> <descriptorRefs>
>>> <descriptorRef>
>>> jar-with-dependencies
>>> </descriptorRef>
>>> </descriptorRefs>
>>> </configuration>
>>> </execution>
>>> </executions>
>>> </plugin>
>>> </plugins>
>>> </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
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Building a tar and zip of jars from other projects
Posted by Ron Wheeler <rw...@artifact-software.com>.
Thanks for the quick reply. See below.
On 28/06/2010 4:37 PM, Marshall Schor wrote:
>
> On 6/28/2010 4:12 PM, Ron Wheeler wrote:
>
>> I am trying to build a pom in its own project that will assemble a tar
>> file and a zip file that will contain all of the jar files that we
>> build that need to go into the tomcat/lib directory.
>>
>>
>> I am missing 2 things.
>> 1) What do I say to tell the maven-assembly-plugin that I want a tar
>> and a zip built?
>>
> There are two ways to configure the assembly plugin - one uses
> "predefined" descriptors, the other lets you specify specific
> instructions in a descriptor of your own that you point to - use the
> parameter<descriptors> instead of<descriptorRefs>.
>
>
Where are the "predefined descriptors" documented?
> Then write your own assembly descriptor.
Do I need to write my own?
> See
> http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html for
> instructions on how to do this. You'll see an element<formats> where
> you can specify the tar and zip formats.
>
>
>> 2) How to I tell the maven-assembly-plugin that I want the jar files
>> zipped up without the contents being extracted and zipped as
>> individual classes?
>>
> In the custom assembly descriptor you make, you can control this using
> the<unpack> option, see the details in the above documentation.
>
> For a book chapter on how to do all kinds of things with assemblies, see:
> http://www.sonatype.com/books/mvnref-book/reference/assemblies.html
>
>
Unpack seems to be too late. Once you merge the jars, I don't see how
you can reconstruct the jars during the unpack.
Ron
> -Marshall Schor
>
>
>
>
>
>> I have built a test pom shown below.
>> Since it has
>> <descriptorRef>
>> jar-with-dependencies
>> </descriptorRef>
>> it restructures the internal jar contents rather than creating a tar
>> of jar files.
>>
>> I did find a nice article from Sonatype but these questions remain.
>> Ron
>>
>>
>>
>> <project xmlns="http://maven.apache.org/POM/4.0.0"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>> http://maven.apache.org/xsd/maven-4.0.0.xsd">
>> <modelVersion>4.0.0</modelVersion>
>> <parent>
>> <groupId>com.artifact_software.lms</groupId>
>> <artifactId>lms-pom-master</artifactId>
>> <version>1.8.3-SNAPSHOT</version>
>> </parent>
>>
>> <groupId>com.artifact_software.lms</groupId>
>> <artifactId>lms-deployment-jars</artifactId>
>> <version>1.8.3-SNAPSHOT</version>
>> <packaging>pom</packaging>
>> <description>Artifact LMS Portal Shared Library Archive
>> builder.</description>
>>
>> <name>lms-deploymentjars</name>
>>
>> <properties>
>> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>> </properties>
>>
>> <dependencies>
>> <dependency>
>> <groupId>com.artifact_software.lms</groupId>
>> <artifactId>lms-pom-spring-hibernate-mysql-tomcat</artifactId>
>> <version>${lms-project.version}</version>
>> <type>pom</type>
>> </dependency>
>> <dependency>
>> <groupId>com.artifact_software.lms</groupId>
>> <artifactId>lms-pom-jsf</artifactId>
>> <version>${lms-project.version}</version>
>> <type>pom</type>
>> </dependency>
>> </dependencies>
>> <build>
>> <plugins>
>> <plugin>
>> <artifactId>maven-assembly-plugin</artifactId>
>> <version>2.2-beta-2</version>
>> <executions>
>> <execution>
>> <id>create-jar-deployment-archive</id>
>> <phase>package</phase>
>> <goals>
>> <goal>single</goal>
>> </goals>
>> <configuration>
>> <descriptorRefs>
>> <descriptorRef>
>> jar-with-dependencies
>> </descriptorRef>
>> </descriptorRefs>
>> </configuration>
>> </execution>
>> </executions>
>> </plugin>
>> </plugins>
>> </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
Re: Building a tar and zip of jars from other projects
Posted by Marshall Schor <ms...@schor.com>.
On 6/28/2010 4:12 PM, Ron Wheeler wrote:
> I am trying to build a pom in its own project that will assemble a tar
> file and a zip file that will contain all of the jar files that we
> build that need to go into the tomcat/lib directory.
>
>
> I am missing 2 things.
> 1) What do I say to tell the maven-assembly-plugin that I want a tar
> and a zip built?
There are two ways to configure the assembly plugin - one uses
"predefined" descriptors, the other lets you specify specific
instructions in a descriptor of your own that you point to - use the
parameter <descriptors> instead of <descriptorRefs>.
Then write your own assembly descriptor. See
http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html for
instructions on how to do this. You'll see an element <formats> where
you can specify the tar and zip formats.
> 2) How to I tell the maven-assembly-plugin that I want the jar files
> zipped up without the contents being extracted and zipped as
> individual classes?
In the custom assembly descriptor you make, you can control this using
the <unpack> option, see the details in the above documentation.
For a book chapter on how to do all kinds of things with assemblies, see:
http://www.sonatype.com/books/mvnref-book/reference/assemblies.html
-Marshall Schor
>
> I have built a test pom shown below.
> Since it has
> <descriptorRef>
> jar-with-dependencies
> </descriptorRef>
> it restructures the internal jar contents rather than creating a tar
> of jar files.
>
> I did find a nice article from Sonatype but these questions remain.
> Ron
>
>
>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <parent>
> <groupId>com.artifact_software.lms</groupId>
> <artifactId>lms-pom-master</artifactId>
> <version>1.8.3-SNAPSHOT</version>
> </parent>
>
> <groupId>com.artifact_software.lms</groupId>
> <artifactId>lms-deployment-jars</artifactId>
> <version>1.8.3-SNAPSHOT</version>
> <packaging>pom</packaging>
> <description>Artifact LMS Portal Shared Library Archive
> builder.</description>
>
> <name>lms-deploymentjars</name>
>
> <properties>
> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
> </properties>
>
> <dependencies>
> <dependency>
> <groupId>com.artifact_software.lms</groupId>
> <artifactId>lms-pom-spring-hibernate-mysql-tomcat</artifactId>
> <version>${lms-project.version}</version>
> <type>pom</type>
> </dependency>
> <dependency>
> <groupId>com.artifact_software.lms</groupId>
> <artifactId>lms-pom-jsf</artifactId>
> <version>${lms-project.version}</version>
> <type>pom</type>
> </dependency>
> </dependencies>
> <build>
> <plugins>
> <plugin>
> <artifactId>maven-assembly-plugin</artifactId>
> <version>2.2-beta-2</version>
> <executions>
> <execution>
> <id>create-jar-deployment-archive</id>
> <phase>package</phase>
> <goals>
> <goal>single</goal>
> </goals>
> <configuration>
> <descriptorRefs>
> <descriptorRef>
> jar-with-dependencies
> </descriptorRef>
> </descriptorRefs>
> </configuration>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </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