Created
February 3, 2014 19:02
-
-
Save rladstaetter/8790077 to your computer and use it in GitHub Desktop.
A pom file which shows the basics to setup a maven build with visualstudio projects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<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> | |
<parent> | |
<groupId>com.example</groupId> | |
<artifactId>super-pom</artifactId> | |
<version>1.0.0-SNAPSHOT</version> | |
</parent> | |
<artifactId>morestuff</artifactId> | |
<name>com.example.morestuff</name> | |
<dependencies> | |
<dependency> | |
<groupId>com.external</groupId> | |
<artifactId>stuff</artifactId> | |
<version>8.1.0</version> | |
<classifier>interface</classifier> | |
<type>zip</type> | |
</dependency> | |
<dependency> | |
<groupId>com.example</groupId> | |
<artifactId>ownstuff</artifactId> | |
<version>${project.version}</version> | |
<classifier>interface</classifier> | |
<type>zip</type> | |
</dependency> | |
<dependency> | |
<groupId>com.example</groupId> | |
<artifactId>ownstuff</artifactId> | |
<version>${project.version}</version> | |
<classifier>debug-artifacts</classifier> | |
<type>zip</type> | |
</dependency> | |
<dependency> | |
<groupId>com.example</groupId> | |
<artifactId>ownstuff</artifactId> | |
<version>${project.version}</version> | |
<classifier>release-artifacts</classifier> | |
<type>zip</type> | |
</dependency> | |
</dependencies> | |
<build> | |
<plugins> | |
<plugin> | |
<artifactId>maven-antrun-plugin</artifactId> | |
<executions> | |
<execution> | |
<id>filter-assemblies</id> | |
<phase>initialize</phase> | |
<goals> | |
<goal>run</goal> | |
</goals> | |
<configuration> | |
<tasks> | |
<copy file="assembly.xml" toFile="target/release-artifacts.xml"> | |
<filterset> | |
<filter token="build.mode" value="release"/> | |
<filter token="solution.configuration" value="Release"/> | |
</filterset> | |
</copy> | |
<copy file="assembly.xml" toFile="target/debug-artifacts.xml"> | |
<filterset> | |
<filter token="build.mode" value="debug"/> | |
<filter token="solution.configuration" value="Debug"/> | |
</filterset> | |
</copy> | |
</tasks> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-dependency-plugin</artifactId> | |
<executions> | |
<execution> | |
<id>unpack-release-dependencies</id> | |
<phase>generate-sources</phase> | |
<goals> | |
<goal>unpack-dependencies</goal> | |
</goals> | |
<configuration> | |
<includeArtifactIds>stuff</includeArtifactIds> <!-- references com.external:stuff --> | |
<includeClassifiers>release-artifacts,interface</includeClassifiers> | |
<outputDirectory>${project.build.directory}/deps/release/</outputDirectory> | |
<overWriteReleases>true</overWriteReleases> | |
<overWriteSnapshots>true</overWriteSnapshots> | |
<overWriteIfNewer>true</overWriteIfNewer> | |
</configuration> | |
</execution> | |
<execution> | |
<id>unpack-debug-dependencies</id> | |
<phase>generate-sources</phase> | |
<goals> | |
<goal>unpack-dependencies</goal> | |
</goals> | |
<configuration> | |
<includeArtifactIds>stuff</includeArtifactIds> | |
<includeClassifiers>debug-artifacts,interface</includeClassifiers> | |
<outputDirectory>${project.build.directory}/deps/debug/</outputDirectory> | |
<overWriteReleases>true</overWriteReleases> | |
<overWriteSnapshots>true</overWriteSnapshots> | |
<overWriteIfNewer>true</overWriteIfNewer> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
<plugin> <!-- call visual studio compiler --> | |
<groupId>org.codehaus.mojo</groupId> | |
<artifactId>exec-maven-plugin</artifactId> | |
<executions> | |
<execution> | |
<id>compile-release</id> | |
<phase>compile</phase> | |
<goals> | |
<goal>exec</goal> | |
</goals> | |
<configuration> | |
<workingDirectory>${project.basedir}</workingDirectory> | |
<executable>${visualstudio.devenv}</executable> | |
<arguments> | |
<argument>example.sln</argument> | |
<argument>/Build</argument> | |
<argument>Release</argument> | |
</arguments> | |
</configuration> | |
</execution> | |
<execution> | |
<id>compile-debug</id> | |
<phase>compile</phase> | |
<goals> | |
<goal>exec</goal> | |
</goals> | |
<configuration> | |
<workingDirectory>${project.basedir}</workingDirectory> | |
<executable>${visualstudio.devenv}</executable> | |
<arguments> | |
<argument>example.sln</argument> | |
<argument>/Build</argument> | |
<argument>Debug</argument> | |
</arguments> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
<plugin> | |
<artifactId>maven-assembly-plugin</artifactId> | |
<version>2.3</version> | |
<configuration> | |
<descriptors> | |
<descriptor>target/release-artifacts.xml</descriptor> | |
<descriptor>target/debug-artifacts.xml</descriptor> | |
<descriptor>interface.xml</descriptor> <!-- this assembly contains the public interface (.h files) --> | |
</descriptors> | |
</configuration> | |
<executions> | |
<execution> | |
<phase>package</phase> | |
<goals> | |
<goal>single</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment