由于缺少库而导致构建失败 [英] Build failure due to missing libraries

查看:94
本文介绍了由于缺少库而导致构建失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project spring-intergation: Compilation failure: Compilation failure:
[ERROR] \spring-intergation\src\main\java\uk\co\dd\spring\domain\User.java:[3,24] package javax.persistence does not exist
[ERROR] \spring-intergation\src\main\java\uk\co\dd\spring\domain\User.java:[4,24] package javax.persistence does not exist
[ERROR] \spring-intergation\src\main\java\uk\co\dd\spring\domain\User.java:[5,24] package javax.persistence does not exist
[ERROR] \spring-intergation\src\main\java\uk\co\dd\spring\domain\User.java:[6,24] package javax.persistence does not exist
[ERROR] \spring-intergation\src\main\java\uk\co\dd\spring\domain\User.java:[7,24] package javax.persistence does not exist
[ERROR] \spring-intergation\src\main\java\uk\co\dd\spring\domain\User.java:[9,1] cannot find symbol

但是我通过右键单击项目并添加外部jar,在eclipse中添加了所有库.

But i have added all the libraries in my eclipse by right clicking the project and adding the external jars.

当我尝试运行mvn编译时,我得到了这些错误,同时也丢失了许多其他jar.

When i try to run mvn compile i get these errors with a lot of other jars also missing.

<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/maven-v4_0_0.xsd">
    <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>java</goal>
            </goals>
          </execution>
        </executions>

        <configuration>
          <mainClass>uk.co.dd.spring.App</mainClass>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <modelVersion>4.0.0</modelVersion>
  <groupId>uk.co.dd.spring</groupId>
  <artifactId>spring-intergation</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>spring-intergation</name>
  <url>http://maven.apache.org</url>
  <dependencies>

    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring</artifactId>
      <version>2.5.5</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>



  </dependencies>
</project>

我应该对POM.xml做任何事情

Should i do anything with POM.xml

推荐答案

将此添加到您的依赖项

<dependency>
  <groupId>javax.persistence</groupId>
  <artifactId>persistence-api</artifactId>  
  <version>1.0</version>
</dependency>

这篇关于由于缺少库而导致构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆