Arnaud Heritier created MSHADE-185:
--------------------------------------

             Summary: systemPath content is interpolated for system dependencies
                 Key: MSHADE-185
                 URL: https://jira.codehaus.org/browse/MSHADE-185
             Project: Maven Shade Plugin
          Issue Type: Bug
    Affects Versions: 2.3, 2.2
            Reporter: Arnaud Heritier


For example with such a POM :

{code}
<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>
{code}

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

    <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>

{code}

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




--
This message was sent by Atlassian JIRA
(v6.1.6#6162)

Reply via email to