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

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

Attached a sample project. To see the problem, run:
{code:java}
mvn clean package
unzip -l schedulekeeper/target/schedulekeeper-25.5-zip-with-dependencies.zip 
{code}
That will show the "/" and "/jetty-deps-25.5.pom" entries. You can also unzip 
to a temporary directory to see the actual warnings from unzip.
{code:java}
unzip -l schedulekeeper/target/schedulekeeper-25.5-zip-with-dependencies.zip 
Archive:  schedulekeeper/target/schedulekeeper-25.5-zip-with-dependencies.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  06-10-2020 21:19   /
     3045  07-07-2020 08:02   /jetty-deps-25.5.pom
   649028  02-28-2020 13:13   jetty-server-9.4.19.v20190610.jar
    95806  02-28-2020 13:13   javax.servlet-api-3.1.0.jar
   155937  02-28-2020 13:13   jetty-io-9.4.19.v20190610.jar
... {code}
 

> 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