You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by jaybytez <ja...@yahoo.com> on 2011/01/11 02:11:46 UTC
Tar pom.xml dependencies - Maven Assembly Plugin?
Is the Maven Assembly Plugin the right way for me to define a pom.xml and be
able to tar up the jars that are labeled as a dependency?
The only way I know how to do this with my limited knowledge is to make the
pom.xml a war and allow the war to pull all the dependency jars into the
target directory and then tar those up.
Thanks for your help,
Jay Blanton
--
View this message in context: http://maven.40175.n5.nabble.com/Tar-pom-xml-dependencies-Maven-Assembly-Plugin-tp3335797p3335797.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Tar pom.xml dependencies - Maven Assembly Plugin?
Posted by khaido <kh...@impinj.com>.
If you are building an web application (war or ear) then I would take a look at the maven-war-plugin and maven-ear-plugin. Here's an example:
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<warSourceDirectory>
${basedir}/target/jwsc-generated/jws
</warSourceDirectory>
<webXml>${basedir}/src/main/webapp/web.xml</webXml>
</configuration>
</plugin>
--
View this message in context: http://maven.40175.n5.nabble.com/Tar-pom-xml-dependencies-Maven-Assembly-Plugin-tp3335797p3336789.html
Sent from the Maven - Users mailing list archive at Nabble.com.
Re: Tar pom.xml dependencies - Maven Assembly Plugin?
Posted by Anders Hammar <an...@hammar.net>.
It looks like you have a pom project, but have declared to use the project's
artifact. A pom project only have the pom artifact, so that might be the
reason of the error message. Try declaring useProjectArtifact as false.
/Anders
On Tue, Jan 11, 2011 at 22:43, jaybytez <ja...@yahoo.com> wrote:
>
> Thanks...I went through the example and created a bin.xml that represented
> the jar-with-dependencies example.
>
> <assembly
> xmlns="
> http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
> xsi:schemaLocation="
> http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0
> http://maven.apache.org/xsd/assembly-1.1.0.xsd">
> <!-- TODO: a jarjar format would be better -->
> <id>jar-with-dependencies</id>
> <formats>
> <format>jar</format>
> </formats>
> <includeBaseDirectory>false</includeBaseDirectory>
> <dependencySets>
> <dependencySet>
> <outputDirectory>/</outputDirectory>
> <useProjectArtifact>true</useProjectArtifact>
> <unpack>true</unpack>
> <scope>runtime</scope>
> </dependencySet>
> </dependencySets>
> </assembly>
>
> And it throws an error when I try this with a sample pom.
>
> [INFO] Scanning for projects...
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building Cookbook :: generate-assembly
> [INFO] task-segment: [package]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] [site:attach-descriptor {execution: default-attach-descriptor}]
> [WARNING] DEPRECATED [descriptor]: Please use descriptors instead
> [INFO] [assembly:single {execution: default}]
> [WARNING] Cannot include project artifact:
> org.apache.maven.cookbook:generate-assembly:pom:1.0-SNAPSHOT; it doesn't
> have an associated file or directory.
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Failed to create assembly: Error creating assembly archive
> jar-with-dependencies: You must set at least one file.
>
> [INFO]
> ------------------------------------------------------------------------
> [INFO] For more information, run Maven with the -e switch
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 2 seconds
> [INFO] Finished at: Tue Jan 11 13:42:25 PST 2011
> [INFO] Final Memory: 11M/28M
> [INFO]
> ------------------------------------------------------------------------
>
> Any thoughts?....thanks...jay
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Tar-pom-xml-dependencies-Maven-Assembly-Plugin-tp3335797p3337379.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Tar pom.xml dependencies - Maven Assembly Plugin?
Posted by jaybytez <ja...@yahoo.com>.
Thanks...I went through the example and created a bin.xml that represented
the jar-with-dependencies example.
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0
http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<!-- TODO: a jarjar format would be better -->
<id>jar-with-dependencies</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
</assembly>
And it throws an error when I try this with a sample pom.
[INFO] Scanning for projects...
[INFO]
------------------------------------------------------------------------
[INFO] Building Cookbook :: generate-assembly
[INFO] task-segment: [package]
[INFO]
------------------------------------------------------------------------
[INFO] [site:attach-descriptor {execution: default-attach-descriptor}]
[WARNING] DEPRECATED [descriptor]: Please use descriptors instead
[INFO] [assembly:single {execution: default}]
[WARNING] Cannot include project artifact:
org.apache.maven.cookbook:generate-assembly:pom:1.0-SNAPSHOT; it doesn't
have an associated file or directory.
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Failed to create assembly: Error creating assembly archive
jar-with-dependencies: You must set at least one file.
[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Tue Jan 11 13:42:25 PST 2011
[INFO] Final Memory: 11M/28M
[INFO]
------------------------------------------------------------------------
Any thoughts?....thanks...jay
--
View this message in context: http://maven.40175.n5.nabble.com/Tar-pom-xml-dependencies-Maven-Assembly-Plugin-tp3335797p3337379.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Tar pom.xml dependencies - Maven Assembly Plugin?
Posted by Anders Hammar <an...@hammar.net>.
Yes, the assembly plugin is they way to do this. Declare the packaging as
"pom".
There are several examples at the plugin's homepage, or google for some live
ones.
/Anders
On Tue, Jan 11, 2011 at 02:11, jaybytez <ja...@yahoo.com> wrote:
>
> Is the Maven Assembly Plugin the right way for me to define a pom.xml and
> be
> able to tar up the jars that are labeled as a dependency?
>
> The only way I know how to do this with my limited knowledge is to make the
> pom.xml a war and allow the war to pull all the dependency jars into the
> target directory and then tar those up.
>
> Thanks for your help,
>
> Jay Blanton
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Tar-pom-xml-dependencies-Maven-Assembly-Plugin-tp3335797p3335797.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>