maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (MASSEMBLY-877) give priority to module files when using jar-with-dependencies descriptor
Date Tue, 20 Feb 2018 09:55:00 GMT

     [ https://issues.apache.org/jira/browse/MASSEMBLY-877?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Simon updated MASSEMBLY-877:
----------------------------
    Description: 
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>/</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 ?

  was:
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>

	<!-- This descriptor behave like maven "jar-with-dependency" except it ensure 
		that current module files have always priority on dependency files in case 
		of duplicate -->
	<formats>
		<format>jar</format>
	</formats>
	<includeBaseDirectory>false</includeBaseDirectory>
	<fileSets>
		<fileSet>
			<directory>${project.build.outputDirectory}</directory>
			<outputDirectory>/</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 ?
	


> 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>/</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)

Mime
View raw message