I'm trying to build and test a DLL using Maven and the NAR plugin. The DLL I'm building depends on another DLL, which I built also using the NAR plugin. Here's my POM:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>myproject</artifactId>
<packaging>nar</packaging>
<name>My Project</name>
<version>1.0.0-SNAPSHOT</version>
<properties>
<skipTests>true</skipTests>
</properties>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.codeswarm</groupId>
<artifactId>maven-nar-plugin</artifactId>
<version>20121119</version>
<extensions>true</extensions>
<configuration>
<cpp>
<defines>
<define>DLLEXPORT</define>
</defines>
</cpp>
<libraries>
<library>
<type>shared</type>
</library>
</libraries>
<tests>
<test>
<name>ProjectTest</name>
<link>shared</link>
</test>
</tests>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>shared-library</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>nar</type>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
If I remove the dependency on com.mycompany:shared-library
- also removing the code that wants to call into it - then it works fine. ProjectTest
runs normally and does what it's supposed to. But with the dependency present, maven can't run the test because it can't find shared-library
. It crashes out with error 0xc0000135
.
When I run Maven in debug mode, I can see that when it compiles the test, it correctly adds the include paths for both DLLs' header files to the compiler command. And when it links the test, it correctly adds the export libraries for both DLLs to the linker command. The problem arises when Maven executes the test: Maven wants to add the path to the DLL to the system path, and it does this - but it only adds the path to the myproject
DLL. It does not add the path to the shared-library
DLL. Hence the crash.
Is this a known issue in the maven-nar-plugin? I've also heard it suggested that there are some forks of the NAR plugin floating around; might this problem be fixed in some version of the plugin other than the one I'm using? Or is there some workaround that can be recommended?