Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
2.4
-
None
-
None
-
Java 8 update 5
Maven 3.2.1
Linux (Fedora 20 x86_64)
Description
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.
<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>
(the GAV point to a manually deployed JDK artifact)
<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>
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?