I can build projects with MaVeN from within NetBeans 17. It also works from the command line. As soon as I upgrade to a newer NetBeans, now I try version 24, the pom.xml
becomes unloadable and I cannot build the project from within NetBeans. When I change the Maven Home to the installed MaVeN, version 3.8.7, I can build the project but the pom.xml
remains unloadable. My java version is 21.0.5.
The error message, with the parameters --debug
and --errors
, I get is
Scanning for projects...
Using mirror MINE (https://example.com/nexus/repository/public) for central (https://example.com/nexus/repository/public-development).
Creating adapter using nameMapper 'gav' and factory 'rwlock-local'
Using transporter HttpTransporter with priority 5.0 for https://example.com/nexus/repository/public
Using connector BasicRepositoryConnector with priority 0.0 for https://example.com/nexus/repository/public with username=itsme, password=***
Internal error: java.lang.IllegalArgumentException: Unsupported policy: fix -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.IllegalArgumentException: Unsupported policy: fix
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:109)
A second cause in the stack is:
Caused by: java.lang.IllegalArgumentException: Unsupported policy: fix
at org.eclipse.aether.internal.impl.DefaultChecksumPolicyProvider.validatePolicy (DefaultChecksumPolicyProvider.java:107)
I first thought that it had something to do with connecting to the Nexus repository, but when I use --offline
the error remains.
What is changed in the way that the newer versions of NetBeans connect to Nexus repositories? It does not seem that the problem is outside of NetBeans since it only fails when NetBeans is involved. I tried it with http
but the problem remains the same.
I get the same behaviour if I create a new MaVeN project with NetBeans. Without changing anything to the pom.xml
the pom.xml
is declared unloadable and a fix is not available. The error is the one described above.
Here is a NetBeans generated pom.xml
that is unloadable:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>example</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>21</maven.compiler.release>
<exec.mainClass>org.example.example.Example</exec.mainClass>
</properties>
</project>
The problem was not in the pom.xml
file(s). The problem was in my settings.xml
. I use this file is already for a very long time. During that time the allowed values of the tag <checksumPolicy>
were changed or my value was always incorrect but never a reason to fail.
This was the content of my 'old' settings.xml
:
<pluginRepository>
<id>central</id>
<url>https://example.org/nexus/repository/public</url>
<releases>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fix</checksumPolicy>
</releases>
<snapshots>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fix</checksumPolicy>
</snapshots>
</pluginRepository>
The value fix
is not valid so I changed it to fail
(warn
is the other option) and the error disappeared. Now the error message:
Internal error: java.lang.IllegalArgumentException: Unsupported policy: fix
is also very clear.