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

时间:2016-03-13 14:01:21

标签: java git maven ubuntu

我正在使用我昨天买的TransIP托管的vps。每个插件都应该像maven一样工作。我多次重新安装它,它似乎总是给出错误。

我安装ubuntu 15.10后所做的是:

  1. sudo apt-get install openjdk-8-jdk
  2. sudo apt-get install maven
  3. 然后我将我的存储库从github克隆到名为my name:

    的用户文件夹中

    路径:/ home / mart / [repo的文件夹]

    完成后,我转到该文件夹​​并使用: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上查看我的回购以获取有关该项目的更多信息:https://github.com/Martacus/DiscordBot

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

1 个答案:

答案 0 :(得分:4)

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

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.