最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

How to specify maven properies when using mvnd? - Stack Overflow

matteradmin7PV0评论

I get this error when trying to run mvnd clean install:

[ERROR]   The project com.exmpale:my-project:SP-21.053.00_-SNAPSHOT (/home/username/IdeaProjects/my-project/pom.xml) has 1 error
[ERROR]     Non-resolvable import POM: The following artifacts could not be resolved: .assertj:assertj-bom:pom:3.25.0 (absent): Could not transfer artifact .assertj:assertj-bom:pom:3.25.0 from/to public (
/repository/public/): PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target @ line 5739, column 19 -> [Help 2]

I was able to resolve it for maven by adding .mvn/jvm.config in project root:

-Dmaven.wagon.http.ssl.ignore.validity.dates=true
-Dmaven.wagon.http.ssl.allowall=true
-Dmaven.wagon.http.ssl.insecure=true

For mvnd I tried adding these properties to:

settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation=".0.0 .0.0.xsd" xmlns=".0.0" xmlns:xsi=";>
    <localRepository>/home/username/.m2/repository</localRepository>
    <profiles>
        <profile>
            <id>default</id>
            <properties>
                <maven.wagon.http.ssl.allowall>true</maven.wagon.http.ssl.allowall>
                <maven.wagon.http.ssl.insecure>true</maven.wagon.http.ssl.insecure>
                <maven.wagon.http.ssl.ignore.validity.dates>true</maven.wagon.http.ssl.ignore.validity.dates>
            </properties>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
    </profiles>
    <!-- other tags are omitted -->
</settings>

.mvn/maven.config in project root:

-Dmaven.wagon.http.ssl.ignore.validity.dates=true
-Dmaven.wagon.http.ssl.allowall=true
-Dmaven.wagon.http.ssl.insecure=true

.mvnd.properties in jvmArgs property:

mvnd.jvmArgs=-Dmaven.wagon.http.ssl.ignore.validity.dates=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.insecure=true

and passing them through terminal:

mvnd clean install -Dmaven.wagon.http.ssl.ignore.validity.dates=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.insecure=true

But nothing helped.

mvn --version

Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39)
Maven home: /opt/apache-maven-3.8.8
Java version: 1.8.0_282, vendor: AdoptOpenJDK, runtime: /usr/lib/jvm/jdk8u282-b08/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.7.1-amd64", arch: "amd64", family: "unix"

mvnd --version

Apache Maven Daemon (mvnd) 1.0.2 linux-amd64 native client (cccc1ec8a5b741c62b29f9fb04d37b1678a029bb)
Terminal: .jline.terminal.impl.PosixSysTerminal with pty .jline.terminal.impl.jni.linux.LinuxNativePty
Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
Maven home: /home/username/maven-mvnd-1.0.2-linux-amd64/mvn
Java version: 1.8.0_282, vendor: AdoptOpenJDK, runtime: /usr/lib/jvm/jdk8u282-b08/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.7.1-amd64", arch: "amd64", family: "unix"

I get this error when trying to run mvnd clean install:

[ERROR]   The project com.exmpale:my-project:SP-21.053.00_-SNAPSHOT (/home/username/IdeaProjects/my-project/pom.xml) has 1 error
[ERROR]     Non-resolvable import POM: The following artifacts could not be resolved: .assertj:assertj-bom:pom:3.25.0 (absent): Could not transfer artifact .assertj:assertj-bom:pom:3.25.0 from/to public (https://nexus-ci
/repository/public/): PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target @ line 5739, column 19 -> [Help 2]

I was able to resolve it for maven by adding .mvn/jvm.config in project root:

-Dmaven.wagon.http.ssl.ignore.validity.dates=true
-Dmaven.wagon.http.ssl.allowall=true
-Dmaven.wagon.http.ssl.insecure=true

For mvnd I tried adding these properties to:

settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache./SETTINGS/1.0.0 http://maven.apache./xsd/settings-1.0.0.xsd" xmlns="http://maven.apache./SETTINGS/1.0.0" xmlns:xsi="http://www.w3./2001/XMLSchema-instance">
    <localRepository>/home/username/.m2/repository</localRepository>
    <profiles>
        <profile>
            <id>default</id>
            <properties>
                <maven.wagon.http.ssl.allowall>true</maven.wagon.http.ssl.allowall>
                <maven.wagon.http.ssl.insecure>true</maven.wagon.http.ssl.insecure>
                <maven.wagon.http.ssl.ignore.validity.dates>true</maven.wagon.http.ssl.ignore.validity.dates>
            </properties>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
    </profiles>
    <!-- other tags are omitted -->
</settings>

.mvn/maven.config in project root:

-Dmaven.wagon.http.ssl.ignore.validity.dates=true
-Dmaven.wagon.http.ssl.allowall=true
-Dmaven.wagon.http.ssl.insecure=true

.mvnd.properties in jvmArgs property:

mvnd.jvmArgs=-Dmaven.wagon.http.ssl.ignore.validity.dates=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.insecure=true

and passing them through terminal:

mvnd clean install -Dmaven.wagon.http.ssl.ignore.validity.dates=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.insecure=true

But nothing helped.

mvn --version

Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39)
Maven home: /opt/apache-maven-3.8.8
Java version: 1.8.0_282, vendor: AdoptOpenJDK, runtime: /usr/lib/jvm/jdk8u282-b08/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.7.1-amd64", arch: "amd64", family: "unix"

mvnd --version

Apache Maven Daemon (mvnd) 1.0.2 linux-amd64 native client (cccc1ec8a5b741c62b29f9fb04d37b1678a029bb)
Terminal: .jline.terminal.impl.PosixSysTerminal with pty .jline.terminal.impl.jni.linux.LinuxNativePty
Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
Maven home: /home/username/maven-mvnd-1.0.2-linux-amd64/mvn
Java version: 1.8.0_282, vendor: AdoptOpenJDK, runtime: /usr/lib/jvm/jdk8u282-b08/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.7.1-amd64", arch: "amd64", family: "unix"
Share Improve this question edited Nov 19, 2024 at 3:56 Aleksey asked Nov 18, 2024 at 10:03 AlekseyAleksey 32 bronze badges 2
  • 1 Where have you put them? Please show your setup? – khmarbaise Commented Nov 18, 2024 at 11:24
  • @khmarbaise Thanks for answering, I've updated the question – Aleksey Commented Nov 19, 2024 at 3:51
Add a comment  | 

1 Answer 1

Reset to default 0

I wasn't able to resolve the issue, but I found a workaround:

  1. do mvn clean install to download all dependencies required to build the project

  2. do mvnd -nsu -o clean install to run mvnd in offline mode

  3. if you get errors indicating that some dependencies are missing, for example:

[ERROR] dependency: .mockito:mockito-core:jar:1.9.5 (provided)
[ERROR]     Cannot access public (https://nexus-ci/repository/public/) in offline mode and the artifact .mockito:mockito-core:jar:1.9.5 has not been downloaded from it before.

just download required dependency: mvn dependency:get -DgroupId=.mockito -DartifactId=mockito-core -Dversion=1.9.5

and do mvnd -nsu -o clean install again

Post a comment

comment list (0)

  1. No comments so far