gpt4 book ai didi

java - 使用 Jersey 测试框架的 Maven 构建错误

转载 作者:行者123 更新时间:2023-11-30 08:52:56 26 4
gpt4 key购买 nike

我目前正在开发一个必须部署在 Heroku 上的简单 Java REST 服务。我需要做一些测试,所以我尝试将 Jersey 测试框架集成到我的 Web 服务中。

但是当我运行 mvn clean install 时,我不断收到构建错误。我已经搜索过了,但在这一点上,我一无所知。


这是它(使用 mvn -e clean install):

[INFO] ------------------------------------------------------------------------                                                         
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: null:jetty-project:pom:9.1.1.v20140108

Reason: Cannot find parent: org.eclipse.jetty:jetty-parent for project: null:jetty-project:pom:9.1.1.v20140108 for project null:jetty-project:pom:9.1.1.v20140108


[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Unable to get dependency information: Unable to read the metadata file for artifact 'org.eclipse.jetty:jetty-server:jar': Cannot find parent: org.eclipse.jetty:jetty-parent for project: null:jetty-project:pom:9.1.1.v20140108 for project null:jetty-project:pom:9.1.1.v20140108
org.eclipse.jetty:jetty-server:jar:9.1.1.v20140108

编辑:这是我的 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.mycompagny.stockservice</groupId>
<version>1.0-SNAPSHOT</version>
<artifactId>StockService</artifactId>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.17</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>9.2.10.v20150310</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>9.2.10.v20150310</version>
</dependency>

<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0.1</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.hibernate.ogm</groupId>
<artifactId>hibernate-ogm-mongodb</artifactId>
<version>4.1.3.Final</version>
</dependency>

<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.17</version>
</dependency>

<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.2</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
<artifactId>jersey-test-framework-provider-jetty</artifactId>
<version>2.17</version>
</dependency>

</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals><goal>copy-dependencies</goal></goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
</project>

我做错了什么?可能是因为 Heroku 使用的 jetty 服务器?

最好的问候。

最佳答案

(根据@Yoluk 的建议 in the comment,我发布了 my comment 作为答案)

我遇到了这个问题(在尝试编译 java-asana 时)并且通过使用最新的 apache-maven 版本解决了,现在是 3.3.3(在 2.2.1 中出现错误) .

关于java - 使用 Jersey 测试框架的 Maven 构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30017978/

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