build-helper-maven-plugin : attach-artifact doesn't copy artifact into repository

StackOverflow https://stackoverflow.com/questions/13384624

  •  29-11-2021
  •  | 
  •  

Frage

Do I need to add install-file and deploy-file to my pom after attaching an additional artifact? I believe I added my artifact correctly, but maven seems to think the artifact is already in place even thought it's not there.

After adding my additional artifact to the pom via attach-artifact I see that maven attempts to copy the file and lists the file in local repo maven-metadata-local.xml but the file doesn't get copied because it seems unchanged.

FYI - This artifact is generated by assembly-plugin and if I remove the build-helper then maven doesn't even attempt to copy the artifact.

Please let me know if you have any ideas.

Thanks

Peter

Debug Log

[INFO] Installing ./trunkProject/modules/mymodule/target/dist/added-artifact-lin64-1.0.0.59258.tar.gz 
    to ./m2repo/corp/prod/modules/mymodule/1.0.0-SNAPSHOT/added-artifact-1.0.0-SNAPSHOT-dist.tar.gz
[DEBUG] Skipped re-installing ./trunkProject/modules/mymodule/target/dist/aie-module-mymodule-lin64-1.0.0.59258.tar.gz 
    to ./m2repo/corp/prod/modules/mymodule/1.0.0-SNAPSHOT/added-artifact-1.0.0-SNAPSHOT-dist.tar.gz, 
    seems unchanged

Pom.xml

            <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.7</version>
        <executions>           
            <execution>             
                <id>attach-distribution-artifact</id>             
                <phase>package</phase>             
                <goals>               
                    <goal>attach-artifact</goal>             
                </goals>            
                <configuration>
                  <artifacts>
                    <artifact>
                      <file>${distTop}/${assemblyFinalName}-${real.os.full}-${prod.version}.${svn.revision}.tar.gz</file>
                      <type>tar.gz</type>
                      <classifier>dist</classifier>
                    </artifact>
                  </artifacts>
                </configuration>          
                </execution>         
        </executions>             
    </plugin>

Assembly File

<assembly>
  <id>dist</id>
  <formats>
    <format>${distCompressed.ext}</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <fileSets>
    <fileSet>
      <directory>${kitTop}</directory>
      <excludes>
        <exclude>**/Thumbs.db</exclude>
      </excludes>
      <outputDirectory>/</outputDirectory>
    </fileSet>
  </fileSets>

War es hilfreich?

Lösung

The problem was simple order of operations. The assembly was generate during the install phase which meant the installer-plugin couldn't locate it. I don't have evidence for how this got blocked build-helper but I suspect that assemble-plugin attached, installer-failed to install and recorded the item. When build-help executed it may have been attempting to work which installer plugin already tried.

Solution

  • Remove build-helper
  • Change assembly plugin phase from install to package ensuring that the artifact exists prior to installation
  • set appendAssemblyId to true in pom's maven-assembly-plugin configuration
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top