Maven 2.x Install Plugin

Install with classifier does not install pom

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 2.2
  • Fix Version/s: 2.3
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    2

Description

I have a project wich I need to build only specifying a classifier (in detail: a war project which I need to build with different profiles to include different
configurations. So I set up different filters and the package produces different classified wars).
When I install the artifact, I've got the attached artifact installed but the pom is NOT installed.
The log says "No primary artifact to install, installing attached artifacts instead".
It's maybe related to MINSTALL-18 as it seems the mojo does not recognize the presence of a primary artifact and goes to install the attached artifacts (without installing the POM).
Don't know if this is really a bug or if I am trying a strange/not valid project configuration (a project without a primary artifact).

  1. maven-install-plugin-2.2.patch
    14/May/08 7:41 AM
    5 kB
    Libor Kramolis
  2. pom.xml
    21/Mar/08 6:32 AM
    2 kB
    Frédéric Chuong

Issue Links

Activity

Hide
Libor Kramolis added a comment -

I think it is a BUG because it is recommended to use classifier to distinguish between different deployment environments. Look Building For Different Environments with Maven 2 - http://maven.apache.org/guides/mini/guide-building-for-different-environments.html.

I have similar experience with ejb, war and ear project types.

Show
Libor Kramolis added a comment - I think it is a BUG because it is recommended to use classifier to distinguish between different deployment environments. Look Building For Different Environments with Maven 2 - http://maven.apache.org/guides/mini/guide-building-for-different-environments.html. I have similar experience with ejb, war and ear project types.
Hide
Dennis Lundberg added a comment -

Can someone provide an example project that highlights this problem?

Show
Dennis Lundberg added a comment - Can someone provide an example project that highlights this problem?
Hide
Frédéric Chuong added a comment -

Please find attached an example project.

When issuing "mvn -P local" (the "local" profile sets the classifier), no POM gets installed to the local repository:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven classifier test
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] No sources to compile
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] [jar:jar]
[INFO] [install:install]
[INFO] No primary artifact to install, installing attached artifacts instead.
[INFO] *Installing [...]\target\foobar-b-1.0-SNAPSHOT-local.jar to [...]\foo\bar\B\foobar-b\1.0-SNAPSHOT\foobar-b-1.0-SNAPSHOT-local.jar*
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------

Show
Frédéric Chuong added a comment - Please find attached an example project. When issuing "mvn -P local" (the "local" profile sets the classifier), no POM gets installed to the local repository:
[INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building Maven classifier test [INFO] task-segment: [install] [INFO] ------------------------------------------------------------------------ [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:compile] [INFO] Nothing to compile - all classes are up to date [INFO] [resources:testResources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:testCompile] [INFO] No sources to compile [INFO] [surefire:test] [INFO] No tests to run. [INFO] [jar:jar] [INFO] [install:install] [INFO] No primary artifact to install, installing attached artifacts instead. [INFO] *Installing [...]\target\foobar-b-1.0-SNAPSHOT-local.jar to [...]\foo\bar\B\foobar-b\1.0-SNAPSHOT\foobar-b-1.0-SNAPSHOT-local.jar* [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------
Hide
Libor Kramolis added a comment -

Problem is that when there is an classifier set to artifact there is no primary artifact just pom file. Artifact with classifier is placed in attachedArtifacts. It means that it is necessary to install POM although there is no primary artifact.

This is fixed by attached patch. There is a new method install in a class InstallMojo. This class is subset of same named method of Maven core DefaultArtifactInstaller class. It would be better to change core DefaultArtifactInstaller to ignore null File source argument.

Show
Libor Kramolis added a comment - Problem is that when there is an classifier set to artifact there is no primary artifact just pom file. Artifact with classifier is placed in attachedArtifacts. It means that it is necessary to install POM although there is no primary artifact. This is fixed by attached patch. There is a new method install in a class InstallMojo. This class is subset of same named method of Maven core DefaultArtifactInstaller class. It would be better to change core DefaultArtifactInstaller to ignore null File source argument.
Hide
Libor Kramolis added a comment -

There is same problem in depoy plugin MDEPLOY-78.

Show
Libor Kramolis added a comment - There is same problem in depoy plugin MDEPLOY-78.
Hide
Libor Kramolis added a comment -

Could you increase Priority of this issue? Set it at least to Major as is in MDEPLOY-78.

Show
Libor Kramolis added a comment - Could you increase Priority of this issue? Set it at least to Major as is in MDEPLOY-78.
Hide
Benjamin Bentmann added a comment -

Fixed in r730549.

Show
Benjamin Bentmann added a comment - Fixed in r730549.
Hide
Eduard Papa added a comment -

I am still seeing this issue in version 2.3 of the maven-install-plugin with the original attached pom.xml. I am not seeing a classified pom installed in my local maven repository. I tried both maven 2.2.1 and 2.0.10 and got the same result. Here is the debug log produced from the plugin:

{{
[DEBUG] Plugin dependencies for:

org.apache.maven.plugins:maven-install-plugin:2.3

are:

org.apache.maven:maven-plugin-api:jar:2.0.6:runtime
org.apache.maven:maven-project:jar:2.0.6:runtime
org.apache.maven:maven-model:jar:2.0.6:runtime
org.apache.maven:maven-artifact-manager:jar:2.0.6:runtime
org.apache.maven:maven-artifact:jar:2.0.6:runtime
org.codehaus.plexus:plexus-utils:jar:1.5.6:runtime
org.codehaus.plexus:plexus-digest:jar:1.0:runtime

[DEBUG] org.apache.maven.plugins:maven-install-plugin:maven-plugin:2.3:runtime (selected for runtime)
[DEBUG] org.apache.maven:maven-plugin-api:jar:2.0.6:runtime (selected for runtime)
[DEBUG] org.apache.maven:maven-project:jar:2.0.6:runtime (selected for runtime)
[DEBUG] org.apache.maven:maven-settings:jar:2.0.6:runtime (selected for runtime)
[DEBUG] org.apache.maven:maven-model:jar:2.0.6:runtime (selected for runtime)
[DEBUG] org.codehaus.plexus:plexus-utils:jar:1.4.1:runtime (selected for runtime)
[DEBUG] org.codehaus.plexus:plexus-utils:jar:1.4.1:runtime (selected for runtime)
[DEBUG] org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:runtime (selected for runtime)
[DEBUG] junit:junit:jar:3.8.1:runtime (selected for runtime)
[DEBUG] org.codehaus.plexus:plexus-utils:jar:1.0.4:runtime (removed - nearer found: 1.4.1)
[DEBUG] classworlds:classworlds:jar:1.1-alpha-2:runtime (selected for runtime)
[DEBUG] org.apache.maven:maven-profile:jar:2.0.6:runtime (selected for runtime)
[DEBUG] org.apache.maven:maven-model:jar:2.0.6:runtime (selected for runtime)
[DEBUG] org.apache.maven:maven-artifact-manager:jar:2.0.6:runtime (selected for runtime)
[DEBUG] org.apache.maven:maven-repository-metadata:jar:2.0.6:runtime (selected for runtime)
[DEBUG] org.apache.maven:maven-artifact:jar:2.0.6:runtime (selected for runtime)
[DEBUG] org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:runtime (selected for runtime)
[DEBUG] org.codehaus.plexus:plexus-utils:jar:1.0.4:runtime (removed - nearer found: 1.4.1)
[DEBUG] org.apache.maven:maven-plugin-registry:jar:2.0.6:runtime (selected for runtime)
[DEBUG] org.codehaus.plexus:plexus-utils:jar:1.4.1:runtime (selected for runtime)
[DEBUG] org.apache.maven:maven-artifact:jar:2.0.6:runtime (selected for runtime)
[DEBUG] org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:runtime (selected for runtime)
[DEBUG] junit:junit:jar:3.8.1:runtime (selected for runtime)
[DEBUG] org.codehaus.plexus:plexus-utils:jar:1.0.4:runtime (removed - nearer found: 1.4.1)
[DEBUG] classworlds:classworlds:jar:1.1-alpha-2:runtime (selected for runtime)
[DEBUG] org.apache.maven:maven-model:jar:2.0.6:runtime (selected for runtime)
[DEBUG] org.apache.maven:maven-artifact-manager:jar:2.0.6:runtime (selected for runtime)
[DEBUG] org.apache.maven:maven-repository-metadata:jar:2.0.6:runtime (selected for runtime)
[DEBUG] org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:runtime (selected for runtime)
[DEBUG] org.codehaus.plexus:plexus-utils:jar:1.0.4:runtime (removed - nearer found: 1.4.1)
[DEBUG] org.apache.maven:maven-artifact:jar:2.0.6:runtime (selected for runtime)
[DEBUG] org.codehaus.plexus:plexus-utils:jar:1.4.1:runtime (removed - nearer found: 1.5.6)
[DEBUG] org.codehaus.plexus:plexus-utils:jar:1.5.6:runtime (selected for runtime)
[DEBUG] Retrieving parent-POM: org.codehaus.plexus:plexus-components:pom:1.1.7 for project: null:plexus-digest:jar:1.0 from the repository.
[DEBUG] org.codehaus.plexus:plexus-digest:jar:1.0:runtime (selected for runtime)
[DEBUG] org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-8:runtime (removed - nearer found: 1.0-alpha-9-stable-1)
[DEBUG] The following artifacts were filtered out for plugin: org.apache.maven.plugins:maven-install-plugin:2.3 because they're already in the core of Maven:

org.apache.maven:maven-plugin-api:jar:2.0.6:runtime
org.apache.maven:maven-project:jar:2.0.6:runtime
org.apache.maven:maven-model:jar:2.0.6:runtime
org.apache.maven:maven-artifact-manager:jar:2.0.6:runtime
org.apache.maven:maven-artifact:jar:2.0.6:runtime

These will use the artifact files already in the core ClassRealm instead, to allow them to be included in PluginDescriptor.getArtifacts().

[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-install-plugin:2.3:install' -->
[DEBUG] (f) artifact = foo.bar.B:foobar-b:jar:1.0-SNAPSHOT
[DEBUG] (f) attachedArtifacts = []
[DEBUG] (f) createChecksum = false
[DEBUG] (f) localRepository = [local] -> file://C:\Users\Eduard\.m2\repository
[DEBUG] (f) packaging = jar
[DEBUG] (f) pomFile = G:\Projects\Test\testjar\pom.xml
[DEBUG] (f) updateReleaseInfo = false
[DEBUG] – end configuration –
[INFO] [install:install]
[INFO] Installing G:\Projects\Test\testjar\target\foobar-b-1.0-SNAPSHOT.jar to C:\Users\Eduard\.m2\repository\foo\bar\B\foobar-b\1.0-SNAPSHOT\foobar-b-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Sat Feb 06 20:33:15 EST 2010
[INFO] Final Memory: 18M/245M
[INFO] ------------------------------------------------------------------------
}}

Show
Eduard Papa added a comment - I am still seeing this issue in version 2.3 of the maven-install-plugin with the original attached pom.xml. I am not seeing a classified pom installed in my local maven repository. I tried both maven 2.2.1 and 2.0.10 and got the same result. Here is the debug log produced from the plugin: {{ [DEBUG] Plugin dependencies for: org.apache.maven.plugins:maven-install-plugin:2.3 are: org.apache.maven:maven-plugin-api:jar:2.0.6:runtime org.apache.maven:maven-project:jar:2.0.6:runtime org.apache.maven:maven-model:jar:2.0.6:runtime org.apache.maven:maven-artifact-manager:jar:2.0.6:runtime org.apache.maven:maven-artifact:jar:2.0.6:runtime org.codehaus.plexus:plexus-utils:jar:1.5.6:runtime org.codehaus.plexus:plexus-digest:jar:1.0:runtime [DEBUG] org.apache.maven.plugins:maven-install-plugin:maven-plugin:2.3:runtime (selected for runtime) [DEBUG] org.apache.maven:maven-plugin-api:jar:2.0.6:runtime (selected for runtime) [DEBUG] org.apache.maven:maven-project:jar:2.0.6:runtime (selected for runtime) [DEBUG] org.apache.maven:maven-settings:jar:2.0.6:runtime (selected for runtime) [DEBUG] org.apache.maven:maven-model:jar:2.0.6:runtime (selected for runtime) [DEBUG] org.codehaus.plexus:plexus-utils:jar:1.4.1:runtime (selected for runtime) [DEBUG] org.codehaus.plexus:plexus-utils:jar:1.4.1:runtime (selected for runtime) [DEBUG] org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:runtime (selected for runtime) [DEBUG] junit:junit:jar:3.8.1:runtime (selected for runtime) [DEBUG] org.codehaus.plexus:plexus-utils:jar:1.0.4:runtime (removed - nearer found: 1.4.1) [DEBUG] classworlds:classworlds:jar:1.1-alpha-2:runtime (selected for runtime) [DEBUG] org.apache.maven:maven-profile:jar:2.0.6:runtime (selected for runtime) [DEBUG] org.apache.maven:maven-model:jar:2.0.6:runtime (selected for runtime) [DEBUG] org.apache.maven:maven-artifact-manager:jar:2.0.6:runtime (selected for runtime) [DEBUG] org.apache.maven:maven-repository-metadata:jar:2.0.6:runtime (selected for runtime) [DEBUG] org.apache.maven:maven-artifact:jar:2.0.6:runtime (selected for runtime) [DEBUG] org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:runtime (selected for runtime) [DEBUG] org.codehaus.plexus:plexus-utils:jar:1.0.4:runtime (removed - nearer found: 1.4.1) [DEBUG] org.apache.maven:maven-plugin-registry:jar:2.0.6:runtime (selected for runtime) [DEBUG] org.codehaus.plexus:plexus-utils:jar:1.4.1:runtime (selected for runtime) [DEBUG] org.apache.maven:maven-artifact:jar:2.0.6:runtime (selected for runtime) [DEBUG] org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:runtime (selected for runtime) [DEBUG] junit:junit:jar:3.8.1:runtime (selected for runtime) [DEBUG] org.codehaus.plexus:plexus-utils:jar:1.0.4:runtime (removed - nearer found: 1.4.1) [DEBUG] classworlds:classworlds:jar:1.1-alpha-2:runtime (selected for runtime) [DEBUG] org.apache.maven:maven-model:jar:2.0.6:runtime (selected for runtime) [DEBUG] org.apache.maven:maven-artifact-manager:jar:2.0.6:runtime (selected for runtime) [DEBUG] org.apache.maven:maven-repository-metadata:jar:2.0.6:runtime (selected for runtime) [DEBUG] org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:runtime (selected for runtime) [DEBUG] org.codehaus.plexus:plexus-utils:jar:1.0.4:runtime (removed - nearer found: 1.4.1) [DEBUG] org.apache.maven:maven-artifact:jar:2.0.6:runtime (selected for runtime) [DEBUG] org.codehaus.plexus:plexus-utils:jar:1.4.1:runtime (removed - nearer found: 1.5.6) [DEBUG] org.codehaus.plexus:plexus-utils:jar:1.5.6:runtime (selected for runtime) [DEBUG] Retrieving parent-POM: org.codehaus.plexus:plexus-components:pom:1.1.7 for project: null:plexus-digest:jar:1.0 from the repository. [DEBUG] org.codehaus.plexus:plexus-digest:jar:1.0:runtime (selected for runtime) [DEBUG] org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-8:runtime (removed - nearer found: 1.0-alpha-9-stable-1) [DEBUG] The following artifacts were filtered out for plugin: org.apache.maven.plugins:maven-install-plugin:2.3 because they're already in the core of Maven: org.apache.maven:maven-plugin-api:jar:2.0.6:runtime org.apache.maven:maven-project:jar:2.0.6:runtime org.apache.maven:maven-model:jar:2.0.6:runtime org.apache.maven:maven-artifact-manager:jar:2.0.6:runtime org.apache.maven:maven-artifact:jar:2.0.6:runtime These will use the artifact files already in the core ClassRealm instead, to allow them to be included in PluginDescriptor.getArtifacts(). [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-install-plugin:2.3:install' --> [DEBUG] (f) artifact = foo.bar.B:foobar-b:jar:1.0-SNAPSHOT [DEBUG] (f) attachedArtifacts = [] [DEBUG] (f) createChecksum = false [DEBUG] (f) localRepository = [local] -> file://C:\Users\Eduard\.m2\repository [DEBUG] (f) packaging = jar [DEBUG] (f) pomFile = G:\Projects\Test\testjar\pom.xml [DEBUG] (f) updateReleaseInfo = false [DEBUG] – end configuration – [INFO] [install:install] [INFO] Installing G:\Projects\Test\testjar\target\foobar-b-1.0-SNAPSHOT.jar to C:\Users\Eduard\.m2\repository\foo\bar\B\foobar-b\1.0-SNAPSHOT\foobar-b-1.0-SNAPSHOT.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3 seconds [INFO] Finished at: Sat Feb 06 20:33:15 EST 2010 [INFO] Final Memory: 18M/245M [INFO] ------------------------------------------------------------------------ }}
Hide
Ryan J added a comment - - edited

Can someone clarify the correct (expected) behavior of POM installation when artifacts use classifiers for me? The way I understand it the test POM provided will produce and install classified artifacts and an unclassified POM:

foobar-b-1.0-SNAPSHOT-local.jar
foobar-b-1.0-SNAPSHOT-dev.jar
foobar-b-1.0-SNAPSHOT-staging.jar
foobar-b-1.0-SNAPSHOT.pom

Eduard's comment suggests he expects the POM to also be classified:

foobar-b-1.0-SNAPSHOT-local.jar
foobar-b-1.0-SNAPSHOT-dev.jar
foobar-b-1.0-SNAPSHOT-staging.jar
foobar-b-1.0-SNAPSHOT-local.pom
foobar-b-1.0-SNAPSHOT-dev.pom
foobar-b-1.0-SNAPSHOT-staging.pom

Which is correct?

Also, Eduard, is it possible you forgot to specify a profile in the example you gave? It looks to me like an unclassified artifact was installed which would be the expected behavior if you forgot to specify a profile.

Show
Ryan J added a comment - - edited Can someone clarify the correct (expected) behavior of POM installation when artifacts use classifiers for me? The way I understand it the test POM provided will produce and install classified artifacts and an unclassified POM: foobar-b-1.0-SNAPSHOT-local.jar foobar-b-1.0-SNAPSHOT-dev.jar foobar-b-1.0-SNAPSHOT-staging.jar foobar-b-1.0-SNAPSHOT.pom Eduard's comment suggests he expects the POM to also be classified: foobar-b-1.0-SNAPSHOT-local.jar foobar-b-1.0-SNAPSHOT-dev.jar foobar-b-1.0-SNAPSHOT-staging.jar foobar-b-1.0-SNAPSHOT-local.pom foobar-b-1.0-SNAPSHOT-dev.pom foobar-b-1.0-SNAPSHOT-staging.pom Which is correct? Also, Eduard, is it possible you forgot to specify a profile in the example you gave? It looks to me like an unclassified artifact was installed which would be the expected behavior if you forgot to specify a profile.
Hide
Benjamin Bentmann added a comment -

POMs never have classifiers.

Show
Benjamin Bentmann added a comment - POMs never have classifiers.
Hide
Eduard Papa added a comment - - edited

You are correct Ryan, I did expect the pom to be classified. I could bet I have seen maven do that a couple of years ago but it might have been a proprietary plugin at the place where I worked. Maybe they accomplished that by appending the "classifier" to the version number.

I was hoping that this issue resolved MNG-2759 but it doesn't seem to.

I have a parent project with multiple modules.
parent
--config
--service
--web

The web module depends on classified service module which depends on classified config module. I was using ${buildName} as a classifier for the modules and in the command line was specifying -DbuildName=dev/test/prod. This worked fine when I built from the parent, but when I built just the web module (subdirectory of parent) it failed to resolve the ${buildName} classifier on the transitive config.

So even though I was building with -DbuildName=prod, the dependencies were resolved as
--web-prod
----service-prod
--------config-dev

I was hoping that the install plugin would create a classified pom of the service module, in which it would replace the ${buildName} classifier with dev/test/prod value specified at the time it was built.

Show
Eduard Papa added a comment - - edited You are correct Ryan, I did expect the pom to be classified. I could bet I have seen maven do that a couple of years ago but it might have been a proprietary plugin at the place where I worked. Maybe they accomplished that by appending the "classifier" to the version number. I was hoping that this issue resolved MNG-2759 but it doesn't seem to. I have a parent project with multiple modules. parent --config --service --web The web module depends on classified service module which depends on classified config module. I was using ${buildName} as a classifier for the modules and in the command line was specifying -DbuildName=dev/test/prod. This worked fine when I built from the parent, but when I built just the web module (subdirectory of parent) it failed to resolve the ${buildName} classifier on the transitive config. So even though I was building with -DbuildName=prod, the dependencies were resolved as --web-prod ----service-prod --------config-dev I was hoping that the install plugin would create a classified pom of the service module, in which it would replace the ${buildName} classifier with dev/test/prod value specified at the time it was built.

People

Vote (9)
Watch (13)

Dates

  • Created:
    Updated:
    Resolved: