我有几个Maven2项目使用NAR和SWIG插件来构建混合Java,C& C ++项目。 SWIG插件动态配置NAR插件:
Plugin narPlugin = (Plugin) project.getBuild().getPluginsAsMap()
.get("org.apache.maven.plugins:maven-nar-plugin");
Xpp3Dom narConfig = new Xpp3Dom("configuration");
.
.
.
narPlugin.setConfiguration(narConfig);
现在我想升级到Maven3。从SWIG插件的角度来看,NAR插件的配置似乎有效。也就是说,后续调用
narPlugin.getConfiguration()
显示动态配置,但是当NAR插件执行时,除非在pom中明确添加,否则它没有配置。
我记得在某处看过Maven3通过上述方法缩小了配置范围。那是怎么回事?如何配置Maven3以允许这种插件间配置?
此处参考是pom
<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>ral</groupId>
<artifactId>jtpk-${os.arch}</artifactId>
<packaging>nar</packaging>
<version>2.3-1</version>
<name>jTPK - JNI wrapped astrometric library</name>
<url>http://maven.apache.org</url>
<dependencies></dependencies>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-swig-plugin</artifactId>
<version>2.0.0-7</version>
<extensions>true</extensions>
<configuration>
<!-- Version of swig to use -->
<version>3.0.2-1</version>
<source>swig_tpk.swg</source>
<cpp>true</cpp>
<packageName>org.lcogt.jTPK.swig</packageName>
<!-- Nar config -->
<includePaths>
<includePath>src/main/cpp/lco</includePath>
</includePaths>
<excludes>
<exclude>**/WinClock.cpp</exclude>
</excludes>
<compilerOptions>
<option>-DTIXML_USE_STL=1</option>
</compilerOptions>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-nar-plugin</artifactId>
<version>2.1-5</version>
<extensions>true</extensions>
<configuration></configuration>
<executions>
<execution>
<goals>
<goal>nar-download</goal>
<goal>nar-unpack</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>