-->

Failed to execute goal on project in Maven

2019-08-03 20:18发布

问题:

when i trying to build the maven project its giving me below error

error :

[ERROR] Failed to execute goal on project unstoppable-confluence: Could not resolve dependencies for project com.addteq.confluence.plugin.unstoppable:unstoppable-confluence:atlassian-plugin:1.3: Failed to collect dependencies at com.atlassian.confluence:confluence:jar:6.0.2 -> com.atlassian.security:atlassian-secure-xml:jar:3.2.4: Failed to read artifact descriptor for com.atlassian.security:atlassian-secure-xml:jar:3.2.4: Could not transfer artifact com.atlassian.pom:closedsource-pom:pom:3.0.2 from/to atlassian-public (https://maven.atlassian.com/repository/public): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]

pom.xml

<modelVersion>4.0.0</modelVersion>
<groupId>com.addteq.confluence.plugin.unstoppable</groupId>
<artifactId>unstoppable-confluence</artifactId>
<version>1.3</version>

<organization>
    <name>Addteq</name>
    <url>https://www.addteq.com</url>
</organization>

<name>Unstoppable-Confluence</name>
<description>This is Addteq's Unstoppable plugin for Atlassian Confluence.</description>
<packaging>atlassian-plugin</packaging>

<scm>
    <developerConnection>
        scm:svn:https://svn2.worldnet.ml.com/svnrepos/gmrt_architecture_repo/code-confluence-accessibility/trunk
    </developerConnection>
    <connection>
        scm:svn:https://svn2.worldnet.ml.com/svnrepos/gmrt_architecture_repo/code-confluence-accessibility/trunk
    </connection>
    <url>
        scm:svn:https://svn2.worldnet.ml.com/svnrepos/gmrt_architecture_repo/code-confluence-accessibility/trunk
    </url>
</scm>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.atlassian.confluence</groupId>
        <artifactId>confluence</artifactId>
        <version>${confluence.version}</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.atlassian.upm</groupId>
        <artifactId>licensing-api</artifactId>
        <version>${upm.license.compatibility.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.atlassian.upm</groupId>
        <artifactId>upm-api</artifactId>
        <version>${upm.license.compatibility.version}</version>
        <scope>provided</scope>
    </dependency>

    <!-- WIRED TEST RUNNER DEPENDENCIES -->
    <dependency>
        <groupId>com.atlassian.plugins</groupId>
        <artifactId>atlassian-plugins-osgi-testrunner</artifactId>
        <version>${plugin.testrunner.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>javax.ws.rs</groupId>
        <artifactId>jsr311-api</artifactId>
        <version>1.1.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.2.2-atlassian-1</version>
    </dependency>
    <dependency>
        <groupId>com.atlassian.activeobjects</groupId>
        <artifactId>activeobjects-plugin</artifactId>
        <version>1.0.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.atlassian.confluence.rest</groupId>
        <artifactId>confluence-rest-plugin</artifactId>
        <version>4.0</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>com.atlassian.maven.plugins</groupId>
            <artifactId>maven-confluence-plugin</artifactId>
            <version>${amps.version}</version>
            <extensions>true</extensions>
            <configuration>
                <productVersion>${confluence.version}</productVersion>
                <productDataVersion>${confluence.data.version}</productDataVersion>
                <!--<productDataPath>${basedir}/src/test/resources/generated-test-resources.zip</productDataPath>-->
                <enableFastdev>false</enableFastdev>
                <enableQuickReload>true</enableQuickReload>
                <instructions>                        
                    <DynamicImport-Package>com.atlassian.upm.api.license.entity;version="2.0.1", com.atlassian.upm.api.license;version="2.0.1", com.atlassian.upm.api.util;version="2.0.1", com.atlassian.upm.license.storage.plugin;version="${upm.license.compatibility.version}"</DynamicImport-Package>
                </instructions>          
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
    </plugins>
</build>

<properties>
    <confluence.version>6.0.2</confluence.version>
    <confluence.data.version>6.0.2</confluence.data.version>
    <amps.version>6.2.6</amps.version>
    <plugin.testrunner.version>1.2.0</plugin.testrunner.version>
    <upm.license.compatibility.version>2.20.4</upm.license.compatibility.version>
    <upm.license.storage.compatibility.version>2.15.3</upm.license.storage.compatibility.version>
    <sonar.sources>src/main</sonar.sources>
</properties>
<repositories>
    <repository>
        <id>atlassian</id>
        <name>Atlassian Repository</name>
        <url>https://maven.atlassian.com/content/groups/public/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>atlassian-public</id>
        <url>https://m2proxy.atlassian.com/repository/public/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>

can someone suggest me how to get rid of this error.

and also i have external jars that I directly added from build path> configure build path>

addteq-jira-unstoppable-1.2.jar & unstoppable-confluence-1.3.2.jar

回答1:

As khmarbaise mentioned, the error you are getting is: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Your local keystore (truststore) does not contain the required certificates. Once you add the required certs it will start working. You can do that by following these steps:

  • Copy the URL into the browser and download the certs
    • http://www.wikihow.com/Export-Certificate-Public-Key-from-Chrome
    • http://docs.bvstools.com/home/ssl-documentation/exporting-certificate-authorities-cas-from-a-website
  • Import cert into keystore
    • https://docs.microsoft.com/en-us/azure/java-add-certificate-ca-store
    • Digital Certificate: How to import .cer file in to .truststore file using?
  • You may also have to restart your JVM / IDE if running maven from within IDE

The article below from Atlassian describes a similar issue and provides a solution to the problem: https://confluence.atlassian.com/kb/unable-to-connect-to-ssl-services-due-to-pkix-path-building-failed-779355358.html

To add JAR's directly the correct steps can be found at:

  • https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
  • http://maven.apache.org/plugins/maven-install-plugin/examples/specific-local-repo.html