【问题标题】:I have added the required dependancies but still running into an error [duplicate]我已经添加了所需的依赖项,但仍然遇到错误 [重复]
【发布时间】:2013-02-07 15:36:23
【问题描述】:

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

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>

【问题讨论】:

标签: java hibernate maven


【解决方案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

&lt;repositories&gt; 标签可以放在&lt;project&gt; 标签内的任何位置。我通常在 pom 的开头声明它们。

【讨论】:

  • 我正在尝试添加它,但它不接受它我应该把它放在哪里?我的意思是在我的 pom.xml 的哪一部分?
  • 这作为第一个孩子进入 pom.xml。喜欢 - 4.0.0 ... ... PorjectName ... ... repositories> ... Eclipse 将根据给定的 DTD 显示自动完成。
  • 另一个类似的选项是 spring-maven-releaseSpring Maven Release Repositorymaven.springframework.org/release</url>
  • java.net 存储库根据 Netbeans 被列入黑名单...知道为什么或是否应该关注它吗?
【解决方案2】:

您可以尝试像这样清理并强制更新您的 maven 存储库:

mvn clean -U

【讨论】:

  • 我的IDE是netbeans,应该在哪里输入?
  • 在您的控制台(Windows 上的 cmd)上更改为您的项目路径,然后运行该命令。如果它显示未知命令,您需要将C:/.../maven/bin 路径添加到您的environment PATH variable
  • -U 用于更新快照,而不是发布版本。这里的问题是,在他的 settings.xml 中他可能没有添加这些存储库,并且 maven 无法找到这些包。这些在标准存储库中不可用,而是在 download.java.net/maven/2repository.jboss.org/nexus/content/repositories/deprecated
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2023-01-10
  • 2021-09-15
  • 2022-12-31
  • 2019-04-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-27
相关资源
最近更新 更多