gpt4 book ai didi

jakarta-ee - 错误 : Could not resolve dependencies (maven javaEE project)

转载 作者:行者123 更新时间:2023-12-04 17:18:37 25 4
gpt4 key购买 nike

我有一个 Maven 企业应用程序项目。我在 EJB 项目中创建持久性单元、一个实体类和一个 EJB session Bean。当我尝试构建项目时出现此错误:

Failed to execute goal on project Blog6-ejb: Could not resolve dependencies for project com.mycompany:Blog6-ejb:ejb:1.0-SNAPSHOT: The following artifacts could not be resolved: org.eclipse.persistence:eclipselink:jar:2.2.0, org.eclipse.persistence:javax.persistence:jar:2.0.3, org.eclipse.persistence:org.eclipse.persistence.jpa.modelgen.processor:jar:2.2.0: Failure to find org.eclipse.persistence:eclipselink:jar:2.2.0 in http://ftp.ing.umu.se/mirror/eclipse/rt/eclipselink/maven.repo was cached in the local repository, resolution will not be reattempted until the update interval of eclipselink has elapsed or updates are forced -> [Help 1]

这里是pom.xml中的代码

    <?xml version="1.0" encoding="UTF-8"?>
<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>
<artifactId>Blog6</artifactId>
<groupId>com.mycompany</groupId>
<version>1.0-SNAPSHOT</version>
</parent>

<groupId>com.mycompany</groupId>
<artifactId>Blog6-ejb</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>ejb</packaging>

<name>Blog6-ejb</name>

<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server>
</properties>

<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.0.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>2.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
<ejbVersion>3.1</ejbVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<url>http://ftp.ing.umu.se/mirror/eclipse/rt/eclipselink/maven.repo</url>
<id>eclipselink</id>
<layout>default</layout>
<name>Repository for library Library[eclipselink]</name>
</repository>
</repositories>
</project>

持久性.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="com.mycompany_Blog6-ejb_ejb_1.0-SNAPSHOTPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/sample</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.ddl-generation" value="create-tables"/>
</properties>
</persistence-unit>
</persistence>

感谢帮助

最佳答案

The use of the Eclipse mirrors for Maven repositories has been reported to cause varying issues from artifacts being reported as unavailable to local maven repository corruption. Therefore, instead of using the mirrored download URL: http://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/rt/eclipselink/maven.repo it is recommended that you use the unmirrored URL to directly access the EclipseLink Maven repository on the Eclipse download site instead: http://download.eclipse.org/rt/eclipselink/maven.repo

来源和更多信息:http://wiki.eclipse.org/EclipseLink/Maven包括如何编辑您的 pom 文件以指向不同的存储库。

关于jakarta-ee - 错误 : Could not resolve dependencies (maven javaEE project),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8610558/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com