gigasquid commented on a change in pull request #13626: Re-organize Scala maven
build
URL: https://github.com/apache/incubator-mxnet/pull/13626#discussion_r243092900
##########
File path: scala-package/core/pom.xml
##########
@@ -5,55 +5,71 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.mxnet</groupId>
- <artifactId>mxnet-parent_2.11</artifactId>
+ <artifactId>mxnet-parent</artifactId>
<version>1.5.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <properties>
- <skipTests>true</skipTests>
- <MXNET_DIR>${project.parent.basedir}/..</MXNET_DIR>
- </properties>
-
- <artifactId>mxnet-core_2.11</artifactId>
+ <artifactId>mxnet-core</artifactId>
<name>MXNet Scala Package - Core</name>
- <profiles>
- <profile>
- <id>unittest</id>
- <properties>
- <skipTests>false</skipTests>
- </properties>
- </profile>
- <profile>
- <id>osx-x86_64-cpu</id>
- <properties>
- <platform>osx-x86_64-cpu</platform>
- </properties>
- </profile>
- <profile>
- <id>linux-x86_64-cpu</id>
- <properties>
- <platform>linux-x86_64-cpu</platform>
- </properties>
- </profile>
- <profile>
- <id>linux-x86_64-gpu</id>
- <properties>
- <platform>linux-x86_64-gpu</platform>
- </properties>
- </profile>
- </profiles>
-
<build>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>native-maven-plugin</artifactId>
+ <extensions>true</extensions>
+ <executions>
+ <execution>
+ <id>javah</id>
+ <phase>verify</phase>
+ <configuration>
+ <javahProvider>default</javahProvider>
+
<javahOutputDirectory>${project.build.directory}/custom-javah</javahOutputDirectory>
+ <workingDirectory>${basedir}</workingDirectory>
+
<javahOutputFileName>org_apache_mxnet_native_c_api.h</javahOutputFileName>
+ <javahClassNames>
+ <javahClassName>org.apache.mxnet.LibInfo</javahClassName>
+ </javahClassNames>
+ </configuration>
+ <goals>
+ <goal>javah</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.6.0</version>
+ <executions>
+ <execution>
+ <id>verify-javah</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <successCodes>0</successCodes>
Review comment:
```
$ diff init/target/custom-javah/org_apache_mxnet_init_native_c_api.h
init-native/src/main/native/org_apache_mxnet_init_native_c_api.h
✔ ~/workspace/deep-learning/tmp/incubator-mxnet/scala-package
$ echo $?
0
```
In the documentation, the `exec-maven-plugin` assumes a success-code of `0`.
The successCodes are only used if the values are something other than 0.
https://www.mojohaus.org/exec-maven-plugin/exec-mojo.html#successCodes
`Exit codes to be resolved as successful execution for non-compliant
applications (applications not returning 0 for success).`
So, in this case, since we are checking for zero anyway, the `successCodes`
line is not needed.
To be clear, I'm not talking about taking out the diff check itself, just
the successCodes line:
```
<configuration>
<executable>diff</executable>
<commandlineArgs>${project.build.directory}/custom-javah/org_apache_mxnet_init_native_c_api.h
${project.parent.basedir}/init-native/src/main/native/org_apache_mxnet_init_native_c_api.h</commandlineArgs>
</configuration>
```
## update
I checked my maven version and it was older: `3.2.5`
I upgraded mvn to `3.6.0` and the original code now works with your original
code, but I still think according to the documentation that `successCodes` is
not needed in this case.
It will also prevent problems with other users that are running an older
version of maven like I was.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services