You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Karl Heinz Marbaise (JIRA)" <ji...@apache.org> on 2018/07/29 19:25:00 UTC

[jira] [Commented] (MASSEMBLY-877) give priority to module files when using jar-with-dependencies descriptor

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

Karl Heinz Marbaise commented on MASSEMBLY-877:
-----------------------------------------------

If you run such thing based on classpath it depends on the classpath order which one will be picked up...so there is not guarantee either...

> give priority to module files when using jar-with-dependencies descriptor
> -------------------------------------------------------------------------
>
>                 Key: MASSEMBLY-877
>                 URL: https://issues.apache.org/jira/browse/MASSEMBLY-877
>             Project: Maven Assembly Plugin
>          Issue Type: Improvement
>          Components: component descriptor
>            Reporter: Simon
>            Priority: Major
>
> Currently, when you create an uber jar using {{jar-with-dependencies}} descriptor if there is resource duplicates between current module and dependencies there is no guarantee the module one will be chosen.
> E.g. :
>  module A depends on module B.
>  module A and module B contains a configuration file with the same name/ same path.
> If I build A using jar-with-dependencies descriptor I have no guarantee my assembly will contains the configuration file of A.
> I think this is because jar-with-dependencies use <useProjectArtifact>true</useProjectArtifact> and so there is no priority between the module and its dependencies.
> A solution could be to change the descriptor and use something like this :
> {code:xml}
> <assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
> 	<id>jar-with-dependencies</id>
> 	<formats>
> 		<format>jar</format>
> 	</formats>
> 	<includeBaseDirectory>false</includeBaseDirectory>
> 	<fileSets>
> 		<fileSet>
> 			<directory>${project.build.outputDirectory}</directory>
> 			<outputDirectory/>
> 		</fileSet>
> 	</fileSets>
> 	<dependencySets>
> 		<dependencySet>
> 			<outputDirectory>/</outputDirectory>
> 			<useProjectArtifact>false</useProjectArtifact>
> 			<unpack>true</unpack>
> 			<scope>runtime</scope>
> 		</dependencySet>
> 	</dependencySets>
> </assembly>
> {code}
> As FileSet have priority on dependencySet, it should do the tricks.
> Does it make sense ?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)