Reputation: 199
I am trying to do the following:
<execution>
<id>copy-jre</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.sun</groupId>
<artifactId>jre</artifactId>
<version>${jdk.version}-${os.family}-x64</version>
<type>zip</type>
</artifactItem>
</artifactItems>
<outputDirectory>${target-deployer.cnc.dir}/java/${os.family}/x86_64/</outputDirectory>
</configuration>
</execution>
I want to copy dependency based on the os - windows or linux in my case. But I cant find the correct parameter
Upvotes: 6
Views: 16751
Reputation: 2110
The Sonatype book, "Maven: The Complete Reference" section 9.2 deals with maven properties and lists the following properties that are pertinent to your question:
java.version
os.name
The java.version property seems usable and in my testing returned "1.6.0_27". However, the os.name property is not exactly an "os family" as you requested. In my case os.name returns "Windows Vista", which I imagine is not what you are hoping for. I don't know of a property to get the os family as you desire it so I recommend using maven profiles as prunge mentioned to handle configuring your plugins with the desired os.
Upvotes: 3
Reputation: 23248
You can use profiles to do this.
e.g.
<profile>
<id>platform-windows</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<build>
<plugins>
...
</plugins>
</build>
</profile>
In your case, you might just want to specify os/family in the profile's activation element.
Upvotes: 21