Uploaded image for project: 'Maven Shade Plugin'
  1. Maven Shade Plugin
  2. MSHADE-185

systemPath content is interpolated for system dependencies

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2, 2.3
    • 2.4
    • None

    Description

      For example with such a POM :

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>test.shade</groupId>
        <artifactId>system-dep</artifactId>
        <packaging>jar</packaging>
        <version>1.0.0-SNAPSHOT</version>
        <dependencies>
          <dependency>
            <groupId>jline</groupId>
            <artifactId>jline</artifactId>
            <version>2.12</version>
          </dependency>
          <dependency>
            <groupId>com.sun</groupId>
            <artifactId>tools</artifactId>
            <version>1.6</version>
            <scope>system</scope>
            <systemPath>${tools.jar}</systemPath>
            <optional>true</optional>
          </dependency>
        </dependencies>
        <build>
          <plugins>
            <plugin>
              <artifactId>maven-shade-plugin</artifactId>
              <version>2.3</version>
              <executions>
                <execution>
                  <phase>package</phase>
                  <goals>
                    <goal>shade</goal>
                  </goals>
                  <configuration>
                    <shadedArtifactAttached>false</shadedArtifactAttached>
                    <createDependencyReducedPom>true</createDependencyReducedPom>
                    <createSourcesJar>true</createSourcesJar>
                    <artifactSet>
                      <includes>
                        <include>jline:jline</include>
                      </includes>
                    </artifactSet>
                    <relocations>
                      <relocation>
                        <pattern>jline</pattern>
                        <shadedPattern>org.crsh.console.jline</shadedPattern>
                      </relocation>
                    </relocations> 
                 </configuration>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </build>
        <profiles>
          <!-- required by byteman -->
          <profile>
            <id>default-profile</id>
            <activation>
              <file>
                <exists>${java.home}/../lib/tools.jar</exists>
              </file>
            </activation>
            <properties>
              <tools.jar>${java.home}/../lib/tools.jar</tools.jar>
            </properties>
          </profile>
          <profile>
            <id>mac-jdk6-profile</id>
            <activation>
              <file>
                <exists>${java.home}/../Classes/classes.jar</exists>
              </file>
            </activation>
            <properties>
              <tools.jar>${java.home}/../Classes/classes.jar</tools.jar>
            </properties>
          </profile>
        </profiles>
      </project>
      

      I'll have in the dependency-reduced-pom.xml

          <dependency>
            <groupId>com.sun</groupId>
            <artifactId>tools</artifactId>
            <version>1.6</version>
            <scope>system</scope>
            <systemPath>/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/jre/../lib/tools.jar</systemPath>
            <optional>true</optional>
          </dependency>
      
      

      While a classical jar/install/deploy won't replace such value

      Because of this we can deploy crappy things on central. See : https://jira.exoplatform.org/browse/CRASH-225

      Attachments

        Activity

          People

            khmarbaise Karl Heinz Marbaise
            aheritier Arnaud Heritier
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: