我添加了所需的依赖项,但仍然遇到错误

时间:2013-02-22 04:49:27

标签: java hibernate maven

我正在关注此链接Link来运行我的hibernate应用程序。虽然我已经添加了所有必需的依赖项,但它会遇到以下错误。

The following artifacts could not be resolved: javax.security:jacc:jar:1.0, 
javax.transaction:jta:jar:1.0.1B: Failure to find javax.security:jacc:jar:1.0 in 
http://repo.maven.apache.org/maven2 was cached in the local repository, 
resolution will not be reattempted until the update interval of central 
has elapsed or updates are forced -> [Help 1]

netbeans还在其属性窗口中显示以下消息。

问题:       *某些依赖项工件不在本地存储库中。

我的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>com.myProject</groupId>
  <artifactId>hibernateTesting</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>hibernateTesting</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

       <dependencies>
    <dependency>
      <groupId>hibernate</groupId>
      <artifactId>hibernate</artifactId>
      <version>3.0</version>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>org.hibernate.javax.persistence</groupId>
      <artifactId>hibernate-jpa-2.0-api</artifactId>
      <version>1.0.1.Final</version>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>org.grlea.log.adapters</groupId>
      <artifactId>simple-log-sl4j</artifactId>
      <version>1.7</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>javax.transaction</groupId>
      <artifactId>jta</artifactId>
      <version>1.1</version>
    </dependency>
    <dependency>
      <groupId>javax.security</groupId>
      <artifactId>jacc</artifactId>
      <version>1.0</version>
      <type>jar</type>
    </dependency>
  </dependencies>
</project>

2 个答案:

答案 0 :(得分:1)

尝试将此存储库添加到您的pom.xml

<repositories>
  <repository>
    <id>JBoss Deprecated</id>
    <url>https://repository.jboss.org/nexus/content/repositories/deprecated</url>
  </repository>
  <repository>
    <id>java.net</id>
    <url>http://download.java.net/maven/2/</url>
  </repository>
</repositories>

JBoss存储库将找到javax.security.jcc,java.net存储库将有javax.transaction.jta jar

<repositories>标记可以放在<project>标记内的任何位置。我通常在pom的开头宣布它们。

答案 1 :(得分:0)

您可以尝试清理并强制更新您的maven repo,如下所示:

mvn clean -U
相关问题