[ 
https://issues.apache.org/jira/browse/MASSEMBLY-937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17152755#comment-17152755
 ] 

Michael Pilone commented on MASSEMBLY-937:
------------------------------------------

Thanks for looking into it.

My guess is that a lot of projects put content into a sub-directory, such as 
"schedulekeeper/" or "lib/", and this issue doesn't show up. It seems to only 
be an issue when using a "root" or empty output directory. And unzip seems to 
handle the issue as long as you don't check the exit status of the process so 
projects might just ignore the warning and carry on. But our deployment 
pipeline checks the exit status of each step and fails on the unzip because of 
this warning.

> Module pom dependency with empty outputDirectory is prefixed with forward 
> slash (/)
> -----------------------------------------------------------------------------------
>
>                 Key: MASSEMBLY-937
>                 URL: https://issues.apache.org/jira/browse/MASSEMBLY-937
>             Project: Maven Assembly Plugin
>          Issue Type: Bug
>    Affects Versions: 3.3.0
>         Environment: MacOS 10.14.6
> openjdk version "11.0.3" 2019-04-16
> OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.3+7)
> OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.3+7, mixed mode)
> Maven home: /Users/mpilone/Applications/apache-maven-3.6.3
> Java version: 11.0.3, vendor: AdoptOpenJDK, runtime: 
> /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
> Default locale: en_US, platform encoding: UTF-8
> OS name: "mac os x", version: "10.14.6", arch: "x86_64", family: "mac"
>            Reporter: Michael Pilone
>            Priority: Major
>         Attachments: bug-maven-assembly.zip
>
>
> I have a project with a pom dependency:
> {code:java}
> <dependency>
>     <groupId>org.prss.contentdepot</groupId>
>     <artifactId>jetty-deps</artifactId>
>     <version>${project.version}</version>
>     <type>pom</type>
> </dependency> {code}
> I then attempt to assemble a zip with dependencies using the assembly 
> definition:
> {code:java}
> <id>zip-with-dependencies</id>
>   <formats>
>     <format>zip</format>
>   </formats>
>   <includeBaseDirectory>false</includeBaseDirectory>  
> <dependencySets>
>     <dependencySet>
>       <outputDirectory></outputDirectory>
>       <unpack>false</unpack>
>     </dependencySet>
>   </dependencySets> {code}
> This results in the pom being prefixed with a "/" which causes unzip to 
> complain later:
> {code:java}
> DEBUG] Extension realms for project 
> org.prss.contentdepot:jetty-deps:pom:25.5: (none)
> [DEBUG] Looking up lifecycle mappings for packaging pom from 
> ClassRealm[plexus.core, parent: null]
> [DEBUG] Extension realms for project org.prss.contentdepot:shared:pom:25.5: 
> (none)
> [DEBUG] Looking up lifecycle mappings for packaging pom from 
> ClassRealm[plexus.core, parent: null]
> [DEBUG] Extension realms for project org.prss.contentdepot:parent:pom:25.5: 
> (none)
> [DEBUG] Looking up lifecycle mappings for packaging pom from 
> ClassRealm[plexus.core, parent: null]
> [DEBUG] Adding file: 
> /Users/mpilone/.m2/repository/org/prss/contentdepot/jetty-deps/25.5/jetty-deps-25.5.pom
>  to archive location: /jetty-deps-25.5.pom {code}
> Unzip later:
> {code:java}
> unzip ../schedulekeeper-25.5-zip-with-dependencies.zip 
> Archive:  ../schedulekeeper-25.5-zip-with-dependencies.zip
> warning:  stripped absolute path spec from /
> mapname:  conversion of  failed
>   inflating: orm-25.5.jar          
> ...
>   inflating: jetty-client-9.4.19.v20190610.jar  
>   inflating: jetty-io-9.4.19.v20190610.jar  
> warning:  stripped absolute path spec from /jetty-deps-25.5.pom
>   inflating: jetty-deps-25.5.pom      {code}
> The end result is that unzip returns a '2' error code which causes problems 
> with exit status checks in later deployment scripts.
> The root issue appears to be in 
> AddDependencySetsTask.addNonArchiveDependency. Around line 379 (my line 
> numbers might be off a bit from debug output), it checks if outputDirectory 
> ends with forward-slash and if not, it adds one. But in this case 
> outputDirectory is empty so the forward slash should not be added. Here's 
> some debug output from within that method:
> {code:java}
> [DEBUG] MIKE: 
> source=/Users/mpilone/.m2/repository/org/prss/contentdepot/jetty-deps/25.5/jetty-deps-25.5.pom
> [DEBUG] MIKE: destName=jetty-deps-25.5.pom
> [DEBUG] MIKE: target=/jetty-deps-25.5.pom
> [DEBUG] MIKE: outputDirectory=
> {code}
> It also appears that an empty "/" is somehow getting added to the repository 
> as well. I believe it may be related to the same non-artifact dependency:
> {code:java}
> [DEBUG] adding entry jetty-client-9.4.19.v20190610.jar
> [DEBUG] adding entry jetty-io-9.4.19.v20190610.jar
> [DEBUG] adding directory /
> [DEBUG] adding entry /jetty-deps-25.5.pom
> [DEBUG] adding entry jetty-server-9.4.19.v20190610.jar {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to