Skip to content
5 changes: 4 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,10 @@ if hasArg java; then
bash "${REPODIR}"/java/cuopt/scripts/build_native.sh
source "${REPODIR}"/java/cuopt/scripts/maven.sh
cuopt_maven_args
cuopt_mvn -f "${REPODIR}"/java/cuopt/pom.xml clean package \
# cd into java/cuopt so Maven's directory-search picks up java/cuopt/.mvn/maven.config --
# it walks up from the current working directory, not from -f's directory.
cd "${REPODIR}"/java/cuopt
cuopt_mvn -f pom.xml clean package \
-DskipTests \
-Dcuopt.native.dir="${CUOPT_JAVA_NATIVE_BUILD_DIR}"
fi
Expand Down
8 changes: 8 additions & 0 deletions java/cuopt/.mvn/maven.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-e
-B
-Daether.connector.basic.downstreamThreads=1
-Daether.connector.http.retryHandler.count=8
-Daether.connector.http.retryHandler.interval=5000
-Daether.connector.http.retryHandler.intervalMax=60000
-Daether.connector.http.retryHandler.serviceUnavailable=429,503
-Dmaven.wagon.http.retryHandler.count=5
82 changes: 50 additions & 32 deletions java/cuopt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,38 +109,6 @@ SPDX-License-Identifier: Apache-2.0
</execution>
</executions>
</plugin>
<!-- Sources and javadoc jars are required by any Maven repository we would publish to. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.11.2</version>
<configuration>
<!-- The bindings are documented against the C API rather than in javadoc comments;
missing tags should not fail the build. -->
<doclint>none</doclint>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand All @@ -154,4 +122,54 @@ SPDX-License-Identifier: Apache-2.0
</plugin>
</plugins>
</build>

<profiles>
<!--
Sources and javadoc jars are required by any Maven repository we would publish to, but
not by anything else. Attaching them unconditionally meant every `mvn test`/`verify`
invocation (which never packages anything) still had to resolve maven-source-plugin and
maven-javadoc-plugin from Maven Central, on every CI run, for no reason. That repeated,
unnecessary resolution repeatedly hit Maven Central 429 rate limits. Activate explicitly
with -Pattach-source-javadoc when actually packaging for publishing; mvn test/verify
should not activate it.
-->
<profile>
<id>attach-source-javadoc</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.11.2</version>
<configuration>
<!-- The bindings are documented against the C API rather than in javadoc comments;
missing tags should not fail the build. -->
<doclint>none</doclint>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Loading