Open dkkopp opened 3 years ago
Do you have sample and maven documentation related to this field ? since the jar is generated by our pom.xml ....
You can add it via the maven jar plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>com.google.ortools</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
Will postpone it after release since I need to change our pom.xml runtime template to add a new variable then adapt cmake and makefile to change it.
DevNote add
to all pom.xml in https://github.com/google/or-tools/tree/stable/ortools/java add
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>@JAVA_PACKAGE@</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
For pom-native.xml.in need to use:
<Automatic-Module-Name>@JAVA_PACKAGE@.@JAVA_PLATFORM_OS@</Automatic-Module-Name>
rework:
https://github.com/google/or-tools/blob/86d4c543f717fa8716a9d66c25143660668bf825/cmake/java.cmake#L44-L52
to introduce
JAVA_PLATFORM_OS
and JAVA_PLATFORM_ARCH
so NATIVE_IDENTIFIER
become
set(NATIVE_IDENTIFIER "${JAVA_PLATFORM_OS}-${JAVA_PLATFORM_ARCH}")
todo(mizux): Add JAVA_
prefix to NATIVE_IDENTIFIER
todo(mizux): Rename NATIVE_IDENTIFIER
to PLATFORM_IDENTIFIER
?
also fix Makefile.java https://github.com/google/or-tools/blob/86d4c543f717fa8716a9d66c25143660668bf825/makefiles/Makefile.java.mk#L67-L80 and https://github.com/google/or-tools/blob/8d692f30f37547a4701b436ea02d9376f5625cf6/makefiles/Makefile.java.mk#L424-L435 need to add
$(SED) -i -e 's;@JAVA_PLATFORM_OS@;$(JAVA_PLATFORM_OS);' \
$(TEMP_JAVA_DIR)$S$(JAVA_ORTOOLS_NATIVE_PROJECT)$Spom.xml
see: https://github.com/google/or-tools/blob/8d692f30f37547a4701b436ea02d9376f5625cf6/ortools/java/com/google/ortools/Loader.java#L34 ref: http://java-native-access.github.io/jna/5.10.0/javadoc/com/sun/jna/Platform.html#RESOURCE_PREFIX
What language and solver does this apply to? Java
Describe the problem you are trying to solve. The current Linux jar file cannot be used with the Java module system because it’s file name cannot be converted into an automatic module name. Adding this additional manifest entry will fix this.
Describe the solution you'd like Add
Automatic-Module-Name: com.google.ortools
to theortools-java-xxx.jar
fileAdd
Automatic-Module-Name: com.google.ortools.linux
to theortools-linux-xxx-xxxx.jar
file.Similar automatic module names should be added to the other os specific jar files (i.e .windows, .mac)