Maven Shared Components

Invalid example in maven-archiver documentation

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: maven-archiver-2.4
  • Fix Version/s: maven-archiver-2.4.1
  • Component/s: maven-archiver
  • Labels:
    None
  • Number of attachments :
    1

Description

Using a Maven Repository-Style Classpath example is invalid - configuration options, like classpathLayoutType and classpathMavenRepositoryLayout/classpathLayoutType, as well as referenced plugin versions (2.3 and 2.4) are for maven-war-plugin, while in example maven-jar-plugin is used.

Activity

Hide
Dennis Lundberg added a comment -

The versions that you mention (2.3 and 2.4) are not plugin versions. They are versions of the maven-archiver shared component.

What is wrong with the example?

Show
Dennis Lundberg added a comment - The versions that you mention (2.3 and 2.4) are not plugin versions. They are versions of the maven-archiver shared component. What is wrong with the example?
Hide
Stevo Slavic added a comment -

Seems I misunderstood version info. Nevertheless, configuration options from example seem not to be applicable to current version of maven-jar-plugin - problem with example is [1] when [2].

[1] failed build trace snippet

[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.ManifestConfiguration for 'classpathLayoutType'
[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:723)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        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:1363)
        at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:724)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:468)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        ... 17 more
Caused by: org.codehaus.plexus.component.configurator.ComponentConfigurationException: Cannot find setter nor field in org.apache.maven.archiver.ManifestConfiguration for 'classpathLayoutType'
        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:207)
        at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:137)
        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:1357)
        ... 20 more

[2] maven-jar-plugin:2.2 configuration

<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<configuration>
					<archive>
						<manifest>
							<mainClass>foo.bar.Main</mainClass>
							<addClasspath>true</addClasspath>
							<classpathLayoutType>repository</classpathLayoutType>
						</manifest>
					</archive>
				</configuration>
			</plugin>
Show
Stevo Slavic added a comment - Seems I misunderstood version info. Nevertheless, configuration options from example seem not to be applicable to current version of maven-jar-plugin - problem with example is [1] when [2]. [1] failed build trace snippet
[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.ManifestConfiguration for 'classpathLayoutType'
[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:723)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        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:1363)
        at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:724)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:468)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        ... 17 more
Caused by: org.codehaus.plexus.component.configurator.ComponentConfigurationException: Cannot find setter nor field in org.apache.maven.archiver.ManifestConfiguration for 'classpathLayoutType'
        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:207)
        at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:137)
        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:1357)
        ... 20 more
[2] maven-jar-plugin:2.2 configuration
<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<configuration>
					<archive>
						<manifest>
							<mainClass>foo.bar.Main</mainClass>
							<addClasspath>true</addClasspath>
							<classpathLayoutType>repository</classpathLayoutType>
						</manifest>
					</archive>
				</configuration>
			</plugin>
Hide
Klemens Muthmann added a comment -

I can confirm this bug. Are there plans to fix it?

Show
Klemens Muthmann added a comment - I can confirm this bug. Are there plans to fix it?
Hide
Klemens Muthmann added a comment -

For other people facing this bug. There is an alternative way to create executable jars described here: http://left.subtree.org/2008/01/24/creating-executable-jars-with-maven/

Show
Klemens Muthmann added a comment - For other people facing this bug. There is an alternative way to create executable jars described here: http://left.subtree.org/2008/01/24/creating-executable-jars-with-maven/
Hide
Dennis Lundberg added a comment -

This particular feature was introduced in 2.4 of Maven Archiver, and is undocumented in the reference section on the site. That needs to be fixed.

The feature does work with the JAR Plugin though, but it requires version 2.3 of that plugin.

Show
Dennis Lundberg added a comment - This particular feature was introduced in 2.4 of Maven Archiver, and is undocumented in the reference section on the site. That needs to be fixed. The feature does work with the JAR Plugin though, but it requires version 2.3 of that plugin.
Hide
Dennis Lundberg added a comment -

Sample project that works.

Show
Dennis Lundberg added a comment - Sample project that works.
Hide
Dennis Lundberg added a comment - - edited

Fixed in r899921, r899924 and r942316.

Show
Dennis Lundberg added a comment - - edited Fixed in r899921, r899924 and r942316.

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: