I suggest you have a look at the jar specification... you'll find that jar
files do not currently support nested jar files

2008/10/1 SophosGuy <[EMAIL PROTECTED]>

>
> I am trying to include my dependancy jars in a file inside the jar, in
> order
> to make it easier on users by not requiring making sure files are in the
> right place or class path is set up right. So I first copy all dependancies
> using the maven-dependency-plugin then I want to use the maven-jar-plugin
> to
> add the classpath to the manifest and then include the jars for these
> dependancies together.
>
>
> Basically how do I add additional files to the JAR using maven-jar-plugin?
>
> Here is what I am doing
> <plugin>
>                    <groupId>org.apache.maven.plugins</groupId>
>                    <artifactId>maven-dependency-plugin</artifactId>
>                    <executions>
>                      <execution>
>                        <id>copy-dependencies</id>
>                        <phase>package</phase>
>                        <goals>
>                          <goal>copy-dependencies</goal>
>                        </goals>
>                        <configuration>
>
> <outputDirectory>${project.build.directory}/classes/lib</outputDirectory>
>                          <overWriteReleases>false</overWriteReleases>
>                          <overWriteSnapshots>true</overWriteSnapshots>
>                        </configuration>
>                      </execution>
>                    </executions>
>                  </plugin>
>          <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-jar-plugin</artifactId>
>                <version>2.2</version>
>                <configuration>
>                    <archive>
>                        <!--
>                        <index>true</true>
>                        -->
>                        <includes>
>                            <include>**/classes/lib/*</include>
>                        </includes>
>                        <manifest>
>                            <addClasspath>true</addClasspath>
>                            <classpathPrefix>lib/</classpathPrefix>
>
>
>                        </manifest>
>                    </archive>
>                </configuration>
>            </plugin>
>
> This throws me an error
>
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Failed to configure plugin parameters for:
> org.apache.maven.plugins:maven-jar-plugin:2.2
>
>
>
> Cause: Cannot find setter nor field in
> org.apache.maven.archiver.MavenArchiveConfiguration for 'includes'
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Trace
> org.apache.maven.lifecycle.LifecycleExecutionException: Error configuring:
> org.apache.maven.plugins:maven-jar-plugin. Reason: Unable to parse the
> created DOM for plugin configuration
>        at
>
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:587)
>        at
>
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
>        at
>
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
>        at
>
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
>        at
>
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
>        at
>
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
>        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
>        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
>        at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at
> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>        at
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> Caused by: org.apache.maven.plugin.PluginConfigurationException: Error
> configuring: org.apache.maven.plugins:maven-jar-plugin. Reason: Unable to
> parse the created DOM for plugin configuration
>        at
>
> org.apache.maven.plugin.DefaultPluginManager.populatePluginFields(DefaultPluginManager.java:1288)
>        at
>
> org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:661)
>        at
>
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:429)
>        at
>
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
>        ... 16 more
> Caused by:
> org.codehaus.plexus.component.configurator.ComponentConfigurationException:
> Cannot find setter nor field in
> org.apache.maven.archiver.MavenArchiveConfiguration for 'includes'
>        at
>
> org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.<init>(ComponentValueSetter.java:68)
>        at
>
> org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:134)
>        at
>
> org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.fromConfiguration(ObjectWithFieldsConverter.java:90)
>        at
>
> org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.configure(ComponentValueSetter.java:247)
>        at
>
> org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:137)
>        at
>
> org.codehaus.plexus.component.configurator.BasicComponentConfigurator.configureComponent(BasicComponentConfigurator.java:56)
>        at
>
> org.apache.maven.plugin.DefaultPluginManager.populatePluginFields(DefaultPluginManager.java:1282)
>        ... 19 more
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Trying-to-copy-additional-files-to-jar-tp19760723p19760723.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to