Andreas Kohn created MASSEMBLY-700:
--------------------------------------
Summary: Difference in property expansion between pom and assembly
components
Key: MASSEMBLY-700
URL: https://jira.codehaus.org/browse/MASSEMBLY-700
Project: Maven Assembly Plugin
Issue Type: Bug
Components: component descriptor
Affects Versions: 2.4
Environment: Java 8 update 5
Maven 3.2.1
Linux (Fedora 20 x86_64)
Reporter: Andreas Kohn
My pom.xml contains a property {{java.version}} which points to the version of
java to include in our assembly. In the assembly component for including java I
refer to this property.
{code:title=pom.xml dependency}
<project>
<dependencies>
<!-- Private Java VM -->
<dependency>
<groupId>com.oracle.java</groupId>
<artifactId>jdk</artifactId>
<version>${java.version}</version>
<classifier>linux-x64</classifier>
<type>tar.gz</type>
<!-- "included" -->
<scope>provided</scope>
</dependency>
</dependencies>
<properties>
<java.version>1.7.0_55</java.version>
</properties>
</project>
{code}
(the GAV point to a manually deployed JDK artifact)
{code:title=jdk component}
<component
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.2
http://maven.apache.org/xsd/component-1.1.2.xsd">
<dependencySets>
<!-- Private (stripped) Java VM -->
<dependencySet>
<outputDirectory>releases</outputDirectory>
<includes>
<include>com.oracle.java:jdk:tar.gz</include>
</includes>
<unpack>true</unpack>
<unpackOptions>
<excludes>
<!-- Can likely exclude more, but these
seem to be stable and bring enough value -->
<exclude>jdk${java.version}/db/</exclude>
<exclude>jdk${java.version}/src.zip</exclude>
<exclude>jdk${java.version}/lib/missioncontrol/</exclude>
<exclude>jdk${java.version}/lib/visualvm/</exclude>
<exclude>jdk${java.version}/man/</exclude>
<exclude>jdk${java.version}/jre/lib/desktop/</exclude>
</excludes>
</unpackOptions>
<scope>provided</scope>
<useProjectArtifact>false</useProjectArtifact>
</dependencySet>
</dependencySets>
</component>
{code}
The goal is to trim the size of this artifact to speed up automatic deployments.
Unfortunately I noticed that the exclusions stopped working when the version of
java i'm using for building and the version of java to be included differ: the
maven-assembly-plugin seems to be expanding 'java.version' to the system
property, not the pom property.
I worked around this by using a different property name, but this inconsistency
could potentially confuse people.
Maybe the plugin could "scream loudly" when such a situation is detected, or
use the same priorities when resolving properties as in pom expansion?
--
This message was sent by Atlassian JIRA
(v6.1.6#6162)