Skip to content

Instantly share code, notes, and snippets.

@devzendo
Last active December 20, 2015 01:49
Show Gist options
  • Save devzendo/6052402 to your computer and use it in GitHub Desktop.
Save devzendo/6052402 to your computer and use it in GitHub Desktop.
A pom.xml fragment for building a Maven NAR project.
<properties>
<MSC>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC</MSC>
<SDK>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A</SDK>
<!-- Tests via nar are run in the integration test phase, so turn off the normal test phase. -->
<skipTests>true</skipTests>
</properties>
...
<plugin>
<!-- Not officially released into Central Maven yet, so use a version that is. -->
<groupId>org.codeswarm</groupId>
<artifactId>maven-nar-plugin</artifactId>
<version>20121119</version>
<extensions>true</extensions>
<configuration>
<java>
<include>true</include>
</java>
<javah />
<libraries>
<library>
<type>jni</type>
<narSystemPackage>org.devzendo.foo</narSystemPackage>
</library>
</libraries>
<cpp>
<includePaths>
<includePath>${MSC}\INCLUDE</includePath>
<includePath>${SDK}\INCLUDE</includePath>
</includePaths>
</cpp>
<linker>
<libs>
<lib>
<name>MSVCRT</name>
<directory>${MSC}\LIB</directory>
</lib>
<lib>
<name>MSVCPRT</name>
<directory>${MSC}\LIB</directory>
</lib>
<lib>
<name>OLDNAMES</name>
<directory>${MSC}\LIB</directory>
</lib>
<lib>
<name>KERNEL32</name>
<directory>${SDK}\LIB</directory>
</lib>
<lib>
<name>UUID</name>
<directory>${SDK}\LIB</directory>
</lib>
<lib>
<name>PDH</name>
<directory>${SDK}\LIB</directory>
</lib>
</libs>
</linker>
</configuration>
</plugin>
@devzendo
Copy link
Author

Also need to add the paths to the windows compiler and sdk libraries - setting ${MSC} and ${SDK} appropriately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment