Mikhail Gromov created MSHADE-274:
-------------------------------------
Summary: Can't resolve dependency from parent pom which has
classifier based on property
Key: MSHADE-274
URL: https://issues.apache.org/jira/browse/MSHADE-274
Project: Maven Shade Plugin
Issue Type: Bug
Affects Versions: 3.1.0
Environment: Apache Maven 3.3.9
(bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T23:41:47+07:00)
Java version: 1.8.0_144, vendor: Oracle Corporation
OS name: "linux", version: "4.4.0-116-generic", arch: "amd64", family: "unix"
Reporter: Mikhail Gromov
*What I do:*
Have a parent pom which has dependency:
{code}
<dependency>
<groupId>org.conscrypt</groupId>
<artifactId>conscrypt-openjdk</artifactId>
<version>1.0.1</version>
<classifier>${os.detected.classifier}</classifier>
</dependency>
{code}
and extension in {{<build>}} section:
{code}
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.5.0.Final</version>
</extension>
</extensions>
{code}
This extension fills property {{$\{os.detected.classifier\}}}.
Also this parent pom has Maven Shade plugin configured:
{code}
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"
/>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${shade.main.class}</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
{code}
And I have another project which uses described pom as parent pom.
Run {{mvn clean install}}.
*What I expect:*
Build is successful, Maven Shade plugin finds correct version of Conscrypt jar,
in my case it is
{{org.conscrypt:conscrypt-openjdk:jar:linux-x86_64:1.0.1}}
*What I see instead:*
Build fails. First Maven Shade plugin mentions correct jar with correct
classifier when it names all jars, like this:
{code}
[INFO] Including org.conscrypt:conscrypt-openjdk:jar:linux-x86_64:1.0.1 in the
shaded jar.
{code}
But later build fails with
{code}
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-shade-plugin:3.1.0:shade (default) on project
example-service: Error creating shaded jar: Could not resolve following
dependencies:
[org.conscrypt:conscrypt-openjdk:jar:${os.detected.classifier}:1.0.1
(compile)]: Could not resolve dependencies for project
com.example:example-service:jar:2.7.8-SNAPSHOT: Failure to find
org.conscrypt:conscrypt-openjdk:jar:${os.detected.classifier}:1.0.1 in ...here
goes correct Artifactory URL, omitting for security reasons
{code}
*Notably:*
When I include my dependency and plugin in this child pom, everything works
fine, build succeeds, jar is there.
Is this a bug in Maven Shade plugin, or am I doing something wrong?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)