Maven 2.x Assembly Plugin

Using filtered within dependencySet unpackOptions

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 2.2-beta-2
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Description

The files within the unpacked jar did not apply the filters defined.
pom configuration includes

<configuration>
<filters>
<filter>src/assemble/filter.properties</filter>
</filters>
</configuration>

which contains
storage.id=abcde

assembly.xml defines dependency set
<dependencySet>
<outputDirectory>/snp-agent1</outputDirectory>
<unpack>true</unpack>
<unpackOptions>
<filtered>true</filtered>
</unpackOptions>
<scope>runtime</scope>
<includes>
<include>
XXX.agent:agent-ear-config
</include>
</includes>
</dependencySet>

However, the files within are not filtered.

Issue Links

Activity

Hide
gotama added a comment -

Any progress on this bug? I have the same problem with dependencysets not being filtered. Thanks.

Show
gotama added a comment - Any progress on this bug? I have the same problem with dependencysets not being filtered. Thanks.
Hide
gotama added a comment -

In analyzing the Maven Assembly Plugin code base, from what I can see, the <filtered> tag (child of <unpackoptions>) is not supported.

Please look at AddDependencySetsTask:170:

UnpackOptions opts = dependencySet.getUnpackOptions();
if ( dependencySet.isUnpack() && ( opts != null ) )

{ task.setIncludes( opts.getIncludes() ); task.setExcludes( opts.getExcludes() ); }

It does not appear that Maven Assembly Plugin actually supports the <filtered> tag given this piece of code which ignores the option.

Further, the UnpackOptions.java isFiltered() method is not referenced in the Maven Assembly Plugin code base.

The documentation shows that <DependencySet> supports the <UnpackOptions>, which contains the <filtered> option.

If <DependencySet> supports <UnpackOptions>, it should support all three options; includes, excludes AND filtered - not just two of them.

This is partially implemented support for UnpackOptions. When could we see this completed? Would be appreciated. Thanks.

Show
gotama added a comment - In analyzing the Maven Assembly Plugin code base, from what I can see, the <filtered> tag (child of <unpackoptions>) is not supported. Please look at AddDependencySetsTask:170: UnpackOptions opts = dependencySet.getUnpackOptions(); if ( dependencySet.isUnpack() && ( opts != null ) ) { task.setIncludes( opts.getIncludes() ); task.setExcludes( opts.getExcludes() ); } It does not appear that Maven Assembly Plugin actually supports the <filtered> tag given this piece of code which ignores the option. Further, the UnpackOptions.java isFiltered() method is not referenced in the Maven Assembly Plugin code base. The documentation shows that <DependencySet> supports the <UnpackOptions>, which contains the <filtered> option. If <DependencySet> supports <UnpackOptions>, it should support all three options; includes, excludes AND filtered - not just two of them. This is partially implemented support for UnpackOptions. When could we see this completed? Would be appreciated. Thanks.
Hide
Dan Carbs added a comment -

I have the same problem. This is pretty major.

Show
Dan Carbs added a comment - I have the same problem. This is pretty major.
Hide
José Marcelo Santuci added a comment -

I have the same problem.

Show
José Marcelo Santuci added a comment - I have the same problem.
Hide
Jeff Johnson added a comment -

This is a significant missing feature.

Show
Jeff Johnson added a comment - This is a significant missing feature.
Hide
Matt Innes added a comment -

As per the other comments - I designed my whole build process around filtering dependencySets and I will now have to do a significant amount of refactoring to get it to work. I've taken a look at the code and it's a non-trivial task which is presumably why it hasn't been done yet. If someone with Maven dev knowledge were able to point me in the right direction for fixing this I might give it a go. The existing filtering code applies to files only - I presume this would have to change to operate on streams, or the dependencySet assembly would have to go through an interim file stage ...

Show
Matt Innes added a comment - As per the other comments - I designed my whole build process around filtering dependencySets and I will now have to do a significant amount of refactoring to get it to work. I've taken a look at the code and it's a non-trivial task which is presumably why it hasn't been done yet. If someone with Maven dev knowledge were able to point me in the right direction for fixing this I might give it a go. The existing filtering code applies to files only - I presume this would have to change to operate on streams, or the dependencySet assembly would have to go through an interim file stage ...
Hide
Sylvain Marié added a comment -

+1. Our whole delivery process has been designed with this feature in mind. This is a major feature that would considerably extend the power of assemblies...

Show
Sylvain Marié added a comment - +1. Our whole delivery process has been designed with this feature in mind. This is a major feature that would considerably extend the power of assemblies...
Hide
Andrew Marlow added a comment -

This feature is very important in a project I am working on. I am trying to replace our use of ant with maven and have got stuck replacing an ant task that copies files and substituting variable placeholders for their values during the copy. It does this in ant using filterset. I was hoping that this plugin would give the same functionality (via the filter during unpack in the dependencySet).

Show
Andrew Marlow added a comment - This feature is very important in a project I am working on. I am trying to replace our use of ant with maven and have got stuck replacing an ant task that copies files and substituting variable placeholders for their values during the copy. It does this in ant using filterset. I was hoping that this plugin would give the same functionality (via the filter during unpack in the dependencySet).
Hide
Georges-Etienne Legendre added a comment -

+1...

Show
Georges-Etienne Legendre added a comment - +1...
Hide
Julien Nicoulaud added a comment -

Not fixed yet on 2.2-beta-5, is there a due date for this issue ?

Show
Julien Nicoulaud added a comment - Not fixed yet on 2.2-beta-5, is there a due date for this issue ?
Hide
Luca added a comment -

no news on this issue?
I suppose plexus-archiver must be enhanced for use interpolation or return the list of extracted files.
A workaround could be:

<dependencySets>
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<includes>
<include>my.group:myartifact</include>
</includes>
<outputDirectory>${project.build.directory}/assembly-tmp</outputDirectory>
<unpack>true</unpack>
<unpackOptions>
<filtered>true</filtered><!-- ignored -->
</unpackOptions>
</dependencySet>
</dependencySets>
</fileSets>
<fileSet>
<directory>${project.build.directory}/assembly-tmp</directory>
<outputDirectory>.</outputDirectory>
<filtered>true</filtered>
<includes>
<include>**</include>
</includes>
</fileSet>
</fileSets>

the problem is that the plugin reorder the sets and moves fileSets before dependencySets.

Show
Luca added a comment - no news on this issue? I suppose plexus-archiver must be enhanced for use interpolation or return the list of extracted files. A workaround could be: <dependencySets> <dependencySet> <useProjectArtifact>false</useProjectArtifact> <includes> <include>my.group:myartifact</include> </includes> <outputDirectory>${project.build.directory}/assembly-tmp</outputDirectory> <unpack>true</unpack> <unpackOptions> <filtered>true</filtered><!-- ignored --> </unpackOptions> </dependencySet> </dependencySets> </fileSets> <fileSet> <directory>${project.build.directory}/assembly-tmp</directory> <outputDirectory>.</outputDirectory> <filtered>true</filtered> <includes> <include>**</include> </includes> </fileSet> </fileSets> the problem is that the plugin reorder the sets and moves fileSets before dependencySets.
Hide
John Casey added a comment -

duplicate of MASSEMBLY-206

Show
John Casey added a comment - duplicate of MASSEMBLY-206
Hide
Luca added a comment -

I'm not sure this issue is a duplicate of MASSEMBLY-206.
The unpack phase in dependencyset, in the code is different from the moduleset. The two issues haves the same problem (filtering not works) but resolving MASSEMBLY-206 not implies this issue is fixed

Show
Luca added a comment - I'm not sure this issue is a duplicate of MASSEMBLY-206. The unpack phase in dependencyset, in the code is different from the moduleset. The two issues haves the same problem (filtering not works) but resolving MASSEMBLY-206 not implies this issue is fixed
Hide
Charley Watson added a comment - - edited

this appears to be related to MASSEMBLY-554 which hasn't been addressed.

Show
Charley Watson added a comment - - edited this appears to be related to MASSEMBLY-554 which hasn't been addressed.

People

Vote (19)
Watch (17)

Dates

  • Created:
    Updated:
    Resolved: