java - 使用 Ubuntu 15.10 的 Maven,出现 : mvn clean install; 错误

标签 java git maven ubuntu

<分区>

我正在使用我昨天购买的由 TransIP 托管的 vps。每个插件都像它应该的那样工作,除了 maven。我重新安装了很多次,它似乎一直都在出错。

我在安装 ubuntu 15.10 后所做的是:

  1. sudo apt-get install openjdk-8-jdk
  2. sudo apt-get 安装 maven

然后我将我的存储库从 github 克隆到以我的名字命名的用户文件夹中:

路径:/home/mart/[仓库所在文件夹]

完成后,我转到文件夹并使用:mvn clean install。它给了我这个错误:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Discordbot 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.782 s
[INFO] Finished at: 2016-03-13T14:51:14+01:00
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

我的第二个想法是,也许我可以在不需要运行 mvn clean install 的情况下运行该项目,并且我运行了 mvn exec:java。然后导致错误,因为它找不到依赖项。

这是我的 pom.xml:

<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>martacus.mart.bot</groupId>
  <artifactId>Discordbot</artifactId>
  <version>0.0.1-SNAPSHOT</version>
    <repositories>
        <repository>
            <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
      <repository>
        <id>bintray-thejavanerd-maven</id>
        <name>bintray</name>
        <url>https://jcenter.bintray.com</url>
      </repository>
    </repositories>
    <dependencies>
       <dependency>
         <groupId>com.github.austinv11</groupId>
         <artifactId>Discord4j</artifactId>
         <version>2.3.1</version>
      </dependency>
      <dependency>
        <groupId>net.dean.jraw</groupId>
        <artifactId>JRAW</artifactId>
        <version>0.8.0</version>
      </dependency>
      <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.38</version>
      </dependency>
      <dependency>
        <groupId>com.mashape.unirest</groupId>
        <artifactId>unirest-java</artifactId>
        <version>1.4.8</version>
      </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <mainClass>martacus.mart.bot.Main</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

当我运行“mvn -version”时,我得到:

Apache Maven 3.3.3
Maven home: /usr/share/maven
Java version: 1.8.0_66-internal, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.2.0-30-generic", arch: "amd64", family: "unix"

当我运行“java -version”时,我得到:

openjdk version "1.8.0_66-internal"
OpenJDK Runtime Environment (build 1.8.0_66-internal-b17)
OpenJDK 64-Bit Server VM (build 25.66-b17, mixed mode)

当我在谷歌上搜索时,人们告诉我这与我的代理设置有关。但是我使用的是 vps,公司无法给我代理设置。也许如果有办法找出它们是什么,它可能会解决问题,但我还没有找到获得这些设置的方法。

如果您想在 github 上查看我的 repo 以获取有关该项目的更多信息:https://github.com/Martacus/DiscordBot

一切都在我的普通电脑上运行,但当然一切的设置都不同,我使用的是 Windows 8。我希望人们能帮助我,如果你需要更多信息,请务必告诉我!

最佳答案

这可能与 ca-certificates 的问题有关,尝试运行此命令:

update-ca-certificates -f

根据手册页:

update-ca-certificates is a program that updates the directory /etc/ssl/certs to 
hold SSL certificates and generatescertificates.crt, a concatenated single-file 
list of certificates.

关于java - 使用 Ubuntu 15.10 的 Maven,出现 : mvn clean install; 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35971167/

相关文章:

java - MAVEN_OPTS 环境变量有什么作用?

java - Java中的克隆对象

git - 使用 Github 指南更改作者信息不起作用

git pull 进行本地更改

git - 单独的克隆,或单独的分支

resteasy javax.ws.rs.NotFoundException : Could not find resource for full path

java - 将 Maven 项目迁移到模块 - 忽略 module-info.java

java - 用hadoop计算两个文件记录的集交集和集差

java - 如何删除临时文件?

java - 按字母和数字拆分字符串