Bug #580

maven template dependency classifier naming issue

Added by David Leins over 6 years ago. Updated about 6 years ago.

Status:ResolvedStart date:2018-08-09
Priority:NormalDue date:
Assignee:Jan Moringen% Done:

100%

Category:-Spent time:-
Target version:-

Description

I have encountered a problem while building a series of java applications with the maven template.

Short description: some dependencies stated in the pom.xml are filed under a wrong name in the '.dependencies' folder of the jobs workspace.
This seems to occur when a 'classifier' tag is provided in a dependency definition, which is included in the filename but not searched for by the 'deploy-file' command being run afterwards.

For instance the jacoco 'aware-core' project of the 'fleximir-nightly' distribution is affected.
The jacoco-maven-plugin dependecy itself depends on jacoco-agent, which is defined as follows:

jacoco-maven-plugin.pom

[...]
    <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>org.jacoco.agent</artifactId>
        <classifier>runtime</classifier>
    </dependency>
[...]

The build fails at this point:

    
     mvn -B deploy:deploy-file -Dmaven.repo.local=/home/zirkon/.m2/repo-toolkit-fleximir-nightly -Durl=file:///vol//fleximir-nightly//share/repository -Dfile=.dependencies/org.jacoco.agent-0.8.1.jar -DgeneratePom=false -DpomFile=.dependencies/org.jacoco.agent-0.8.1.pom -Dpackaging=jar
    [INFO] Scanning for projects...
    [INFO]                                                                         
    [INFO] ------------------------------------------------------------------------
    [INFO] Building AWARe Core Engine 0.0.4-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-deploy-plugin:2.7:deploy-file (default-cli) @ aware-core ---
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 0.488 s
    [INFO] Finished at: 2018-08-08T16:53:59+02:00
    [INFO] Final Memory: 11M/240M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on project aware-core: /home/zirkon/citk/jenkins/jobs/aware-core-imemo-ci-deploy-fleximir-nightly/workspace/.dependencies/org.jacoco.agent-0.8.1.jar not found. -> [Help 1]

Checking the content of '.dependecies' with 'ls workspace/.dependecies | grep -i jacoco.agent':

    org.jacoco.agent-0.8.1.pom
    org.jacoco.agent-0.8.1-runtime.jar

The same problem occurs with sisu-guice, where 'sisu-guice-2.1.7.jar' is searched, but inside the .dependencies folder the jar is named 'sisu-guice-2.1.7-noaop.jar'.

sisu-inject-bean.pom:

[...]
    <dependencies>
        <dependency>
          <groupId>org.sonatype.sisu</groupId>
          <artifactId>sisu-guice</artifactId>
          <classifier>noaop</classifier>
          <exclusions>
            <exclusion>
              <groupId>javax.inject</groupId>
              <artifactId>javax.inject</artifactId>
            </exclusion>
            <exclusion>
              <groupId>aopalliance</groupId>
              <artifactId>aopalliance</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
        [...]
    <dependencies>
[...]

Renaming the affected jars between the download/caching and installation process is a workaround to get the build to succeed.

Associated revisions

Revision c6c0feeb
Added by Johannes Wienke about 6 years ago

Support deploying jars with classifiers

This commit enables deploying jars with classifiers to the local
distribution repository. For each pom file now multiple jars will be
uploaded (if they exists) and they will be tagged with the appropriate
classifiers.

fixes #580

History

#1 Updated by Johannes Wienke about 6 years ago

dleins: currently maven.template canonically constructs the name of the jar file from the pom by stripping the .pom extension and replacing it with .jar. This seems to be the culprit here.

Could you try the following patch an test whether it solves your issue:

diff --git a/templates/toolkit/maven.template b/templates/toolkit/maven.template
index cb8a20f6..28f6f3d0 100644
--- a/templates/toolkit/maven.template
+++ b/templates/toolkit/maven.template
@@ -37,9 +37,11 @@
 if ls .dependencies/*.pom >/dev/null 2>&1;
 then
     for pom in .dependencies/*.pom; do
-        jar=\"\\${pom%%.pom}.jar\" 
-        maven_install_with_pom \"\\${jar}\" \"\\${pom}\" \"${maven.install.skip|i}\" 
-        maven_install_flat_jar \"\\${jar}\" 
+        for  jar in \\${pom%%.pom}*.jar
+        do
+            maven_install_with_pom \"\\${jar}\" \"\\${pom}\" \"${maven.install.skip|i}\" 
+            maven_install_flat_jar \"\\${jar}\" 
+        done
     done
 fi
 for jar in \\$(find . -wholename '*/target/*.jar'); do

#2 Updated by Anonymous about 6 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF