我有一个在Netbeans 8中构建的Maven项目,该项目在移至Netbeans 9之前进行了编译。
Netbeans 9正在运行Java 10,我的项目也是如此(在迁移到Netbeans 9之后,我对此进行了更改),POM表示它也在运行版本10。
当我尝试构建项目时,尽管出现此错误消息:
-------------------------------------------------- ------------------------- Building Stellar 1.0 -------------------------------------------------- ----------------------下载: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom
-------------------------------------------------- -------------------------建立失败 -------------------------------------------------- ----------------------总时间:0.456秒完成于:2018-07-29T16:48:26-04:00决赛 记忆体:7M / 34M -------------------------------------------------- ----------------------插件org.apache.maven.plugins:maven-resources-plugin:2.6或以下之一 无法解决其依赖性:无法读取工件 描述符 org.apache.maven.plugins:maven-resources-plugin:jar:2.6:无法 转移伪像 org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from / to 中央(https://repo.maven.apache.org/maven2): java.lang.RuntimeException:意外错误: java.security.InvalidAlgorithmParameterException:trustAnchors 参数必须为非空-> [帮助1]
要查看错误的完整堆栈跟踪,请使用-e重新运行Maven。 开关。使用-X开关重新运行Maven以启用完整的调试日志记录。
有关错误和可能的解决方案的更多信息,请 阅读以下文章:[帮助1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
这是我的POM:
> `<?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>Stellar</groupId>
<artifactId>Stellar</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>10</maven.compiler.source>
<maven.compiler.target>10</maven.compiler.target>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.5</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.controlsfx/controlsfx -->
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>8.40.14</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-parameter-names</artifactId>
<version>2.9.6</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
<version>2.9.6</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.9.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.protonmail.sarahszabo.stellaropusconverter.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>Shaded</shadedClassifierName> <!-- Any name that makes sense -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>`
我该如何解决?
修改0:
使用默认的main方法创建了一个示例测试Maven项目。失败并显示类似错误:
插件org.apache.maven.plugins:maven-clean-plugin:2.5或其中之一 依赖关系无法解析:无法读取工件描述符 对于org.apache.maven.plugins:maven-clean-plugin:jar:2.5:无法 传输工件org.apache.maven.plugins:maven-clean-plugin:pom:2.5 从/到中央(https://repo.maven.apache.org/maven2): java.lang.RuntimeException:意外错误: java.security.InvalidAlgorithmParameterException:trustAnchors 参数必须为非空-> [帮助1]
样本POM:
<?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>com.example</groupId>
<artifactId>mavenproject1</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>10</maven.compiler.source>
<maven.compiler.target>10</maven.compiler.target>
</properties>
</project>
**编辑1:**终端mvn clean install
外面
[错误]插件org.apache.maven.plugins:maven-surefire-plugin:2.12.4 或无法解决其依赖性之一:读取失败 的工件描述符 org.apache.maven.plugins:maven-surefire-plugin:jar:2.12.4:无法 转移伪像 org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4从/到 中央(https://repo.maven.apache.org/maven2): java.lang.RuntimeException:意外错误: java.security.InvalidAlgorithmParameterException:trustAnchors 参数必须为非空-> [帮助1]
IDE(Netbeans 9)尝试清除并构建后登录:
> INFO [org.netbeans.modules.maven.indexer.NexusRepositoryIndexerImpl]:
> Downloaded maven index file has size 0 (zipped). The usable space in
> /home/sarah/.cache/netbeans/9.0 is 222,938,177,536. INFO
> [org.netbeans.modules.maven.indexer.NexusRepositoryIndexerImpl]: could
> not (re-)index central
> java.security.InvalidAlgorithmParameterException: the trustAnchors
> parameter must be non-empty at
> java.base/java.security.cert.PKIXParameters.setTrustAnchors(PKIXParameters.java:200)
> at
> java.base/java.security.cert.PKIXParameters.<init>(PKIXParameters.java:120)
> at
> java.base/java.security.cert.PKIXBuilderParameters.<init>(PKIXBuilderParameters.java:104)
> at
> java.base/sun.security.validator.PKIXValidator.<init>(PKIXValidator.java:86)
> Caused: java.lang.RuntimeException: Unexpected error at
> java.base/sun.security.validator.PKIXValidator.<init>(PKIXValidator.java:89)
> at
> java.base/sun.security.validator.Validator.getInstance(Validator.java:181)
> at
> java.base/sun.security.ssl.X509TrustManagerImpl.getValidator(X509TrustManagerImpl.java:330)
> at
> java.base/sun.security.ssl.X509TrustManagerImpl.checkTrustedInit(X509TrustManagerImpl.java:180)
> at
> java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:192)
> at
> java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:133)
> at
> java.base/sun.security.ssl.ClientHandshaker.checkServerCerts(ClientHandshaker.java:1947)
> at
> java.base/sun.security.ssl.ClientHandshaker.certificateStatus(ClientHandshaker.java:1798)
> at
> java.base/sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:276)
> at
> java.base/sun.security.ssl.Handshaker.processLoop(Handshaker.java:1098)
> at
> java.base/sun.security.ssl.Handshaker.processRecord(Handshaker.java:1026)
> at
> java.base/sun.security.ssl.SSLSocketImpl.processInputRecord(SSLSocketImpl.java:1137)
> at
> java.base/sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1074)
> at
> java.base/sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
> at
> java.base/sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1402)
> at
> java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1429)
> Caused: javax.net.ssl.SSLException at
> java.base/sun.security.ssl.Alerts.getSSLException(Alerts.java:214) at
> java.base/sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1974)
> at
> java.base/sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1926)
> at
> java.base/sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1909)
> at
> java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1436)
> at
> java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
> at
> org.apache.maven.wagon.providers.http.httpclient.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:275)
> at
> org.apache.maven.wagon.providers.http.httpclient.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:254)
> at
> org.apache.maven.wagon.providers.http.httpclient.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:123)
> at
> org.apache.maven.wagon.providers.http.httpclient.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
> at
> org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
> at
> org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
> at
> org.apache.maven.wagon.providers.http.httpclient.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
> at
> org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec.execute(RetryExec.java:86)
> at
> org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
> at
> org.apache.maven.wagon.providers.http.httpclient.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
> at
> org.apache.maven.wagon.providers.http.httpclient.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
> at
> org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.execute(AbstractHttpClientWagon.java:832)
> at
> org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:983)
> Caused: org.apache.maven.wagon.TransferFailedException:
> java.lang.RuntimeException: Unexpected error:
> java.security.InvalidAlgorithmParameterException: the trustAnchors
> parameter must be non-empty at
> org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:1066)
> at
> org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:960)
> at
> org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
> at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
> at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61) at
> org.apache.maven.index.updater.WagonHelper$WagonFetcher.retrieve(WagonHelper.java:220)
> Caused: java.io.IOException: Transfer for
> nexus-maven-repository-index.properties failed;
> java.lang.RuntimeException: Unexpected error:
> java.security.InvalidAlgorithmParameterException: the trustAnchors
> parameter must be non-empty at
> org.apache.maven.index.updater.WagonHelper$WagonFetcher.retrieve(WagonHelper.java:245)
> at
> org.apache.maven.index.updater.WagonHelper$WagonFetcher.retrieve(WagonHelper.java:202)
> at
> org.apache.maven.index.updater.DefaultIndexUpdater.downloadIndexProperties(DefaultIndexUpdater.java:342)
> at
> org.apache.maven.index.updater.DefaultIndexUpdater.access$000(DefaultIndexUpdater.java:76)
> at
> org.apache.maven.index.updater.DefaultIndexUpdater$IndexAdaptor.setProperties(DefaultIndexUpdater.java:465)
> at
> org.apache.maven.index.updater.DefaultIndexUpdater.fetchAndUpdateIndex(DefaultIndexUpdater.java:681)
> at
> org.apache.maven.index.updater.DefaultIndexUpdater.fetchAndUpdateIndex(DefaultIndexUpdater.java:161)
> at
> org.netbeans.modules.maven.indexer.NexusRepositoryIndexerImpl.indexLoadedRepo(NexusRepositoryIndexerImpl.java:529)
> at
> org.netbeans.modules.maven.indexer.NexusRepositoryIndexerImpl.access$200(NexusRepositoryIndexerImpl.java:123)
> [catch] at
> org.netbeans.modules.maven.indexer.NexusRepositoryIndexerImpl$3.run(NexusRepositoryIndexerImpl.java:660)
> at
> org.netbeans.modules.maven.indexer.NexusRepositoryIndexerImpl$3.run(NexusRepositoryIndexerImpl.java:653)
> at
> org.netbeans.modules.openide.util.DefaultMutexImplementation.writeAccess(DefaultMutexImplementation.java:229)
> at org.openide.util.Mutex.writeAccess(Mutex.java:246) at
> org.netbeans.modules.maven.indexer.NexusRepositoryIndexerImpl.indexRepo(NexusRepositoryIndexerImpl.java:653)
> at
> org.netbeans.modules.maven.indexer.api.RepositoryIndexer.indexRepo(RepositoryIndexer.java:42)
> at
> org.netbeans.modules.maven.ProjectOpenedHookImpl$2.run(ProjectOpenedHookImpl.java:207)
> at
> org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
> at
> org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
> at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278) at
> org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/commons-io/commons-io/2.6/commons-io-2.6.jar!/
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.5/jackson-databind-2.9.5.jar!/
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/org/controlsfx/controlsfx/8.40.14/controlsfx-8.40.14.jar!/
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.jar!/
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/junit/junit/4.12/junit-4.12.jar!/
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.9.0/jackson-dataformat-yaml-2.9.0.jar!/
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.6/jackson-module-parameter-names-2.9.6.jar!/
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.6/jackson-datatype-jdk8-2.9.6.jar!/
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.6/jackson-datatype-jsr310-2.9.6.jar!/
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/commons-io/commons-io/2.6/commons-io-2.6.jar!/
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.5/jackson-databind-2.9.5.jar!/
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/org/controlsfx/controlsfx/8.40.14/controlsfx-8.40.14.jar!/
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.jar!/
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/junit/junit/4.12/junit-4.12.jar!/
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.9.0/jackson-dataformat-yaml-2.9.0.jar!/
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.6/jackson-module-parameter-names-2.9.6.jar!/
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.6/jackson-datatype-jdk8-2.9.6.jar!/
> WARNING [org.netbeans.modules.maven.nodes.DependenciesNode]: Could not
> determine module name for artifact
> jar:file:/root/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.6/jackson-datatype-jsr310-2.9.6.jar!/