java - Maven 不会安装 pom 文件中的所有内容,导致 "Missing Required Library"x 124

标签 java eclipse maven pom.xml

我的 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>
<parent>
    <groupId>be.ugent.sop.p404</groupId>
    <artifactId>P404</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>P404EJB</artifactId>
<name>P404EJB</name>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ejb-plugin</artifactId>
            <configuration>
            <ejbVersion>3.1</ejbVersion>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.40.0</version>
    </dependency>

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.29</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>org.eclipse.persistence.jpa</artifactId>
        <version>2.5.2-M1</version>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>


    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
    </dependency>
    <dependency>
        <groupId>org.databene</groupId>
        <artifactId>contiperf</artifactId>
        <version>2.2.0</version>
    </dependency>

    <dependency>

        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.6</version>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.6</version>
    </dependency>



    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
    </dependency>

    <dependency>
        <groupId>org.databene</groupId>
        <artifactId>contiperf</artifactId>
        <version>2.2.0</version>
    </dependency>

    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-j2ee-deployment_1.1_spec</artifactId>
        <version>1.1</version>
    </dependency>

    <dependency>
        <groupId>com.googlecode.json-simple</groupId>
        <artifactId>json-simple</artifactId>
        <version>1.1.1</version>
    </dependency>

    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.4</version>
    </dependency>

</dependencies>

<packaging>ejb</packaging>

作为我收到的问题的示例之一:

Description Resource    Path    Location    Type
Project 'P404EJB' is missing required library: '/home/zeesteen/.m2/repository/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar'   P404EJB     Build path  Build Path Problem

我假设使用以下命令后:

mvn clean install eclipse:eclipse

Maven 应该获取 pom 中但我的机器上不存在的库? (.m2/repository 文件夹中不存在文件夹,例如“com”)

我自己尝试了多种解决方案,例如 - 删除Maven性质,再次全新安装,转换为maven项目 - 对 clean 命令进行变体 - 右键单击​​项目并执行 Maven > 更新项目 - 通过eclipse清理项目

我遇到了 124 个 Java 构建路径问题,就像上面提到的那样。

最佳答案

我发现错误了..

Maven 没有给出错误,因为我的 Maven 存储库显然没有任何问题。 Eclipse 已将我的 settings.xml maven 文件的位置更改为“不存在”的位置。导致了所有问题。我手动改回来,所有问题都解决了。

在 Eclipse 中我做了: 窗口 > 首选项 > Maven > 用户设置:字段用户设置错误 (eclipse改变了它..)把它放回我第一次进行设置的地方,应用,清理项目,一切都修复了!

关于java - Maven 不会安装 pom 文件中的所有内容,导致 "Missing Required Library"x 124,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23564962/

相关文章:

java - Jetty:隐藏 URL 中的端口号

java - 知道为什么 Collections.sort() 在下面的程序中不起作用吗?

java - Retrofit2 HTTP 获取 Json 到 RecyclerView

java - 使用 Facebook 登录的应用程序在开发中无法正常工作!它只是加载并关闭- Android Studio

eclipse - 动态 Web 应用程序、Eclipse、JSF 中的异常 java.lang.NoClassDefFoundError

java - 在 Eclipse 中将 java 项目从 Windows 导出和导入到 Linux

eclipse - 检查 $M2_HOME 环境变量和 mvn 脚本匹配

java - 不工作 spring.config.additional-location

java - 将对象添加到 JComboBox 但显示字符串而不覆盖对象的 .toString() 方法

java - 如何使用 WindowBuilder 在内部类中编辑 JPanel