gpt4 book ai didi

java - 将 Jersey 从 1.x 迁移到 2.x 时出现编译错误

转载 作者:太空宇宙 更新时间:2023-11-04 13:03:15 24 4
gpt4 key购买 nike

我的 pom 文件包含:

<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.22.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.22.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-common</artifactId>
<version>2.22.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jettison</artifactId>
<version>2.21.1</version>
</dependency>

日志中显示的错误:更新错误:

[INFO] --- maven-dependency-plugin:2.10:analyze-only (analyze) @ 
api-services ---
[WARNING] Unused declared dependencies found:
[WARNING] org.glassfish.jersey.core:jersey-client:jar:2.22.1:compile
[WARNING] org.glassfish.jersey.core:jersey-common:jar:2.22.1:compile
[WARNING] org.glassfish.jersey.core:jersey-server:jar:2.22.1:compile
[WARNING] org.glassfish.jersey.media:jersey-media-jaxb:jar:2.22.1:compile
[WARNING] org.glassfish.jersey.media:jersey-media-json-
jackson:jar:2.22.1:compile
Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.10:analyze-only (analyze) on project api-services: Dependency problems found -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.10:analyze-only (analyze) on project api-services: Dependency problems found
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Dependency problems found
at org.apache.maven.plugin.dependency.analyze.AbstractAnalyzeMojo.execute(AbstractAnalyzeMojo.java:260)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)

更新:删除上述依赖项后,我成功构建了我的项目。所以看起来上述之一需要其他依赖项。有什么想法吗?

更新 1:这就是分析的定义方式

      <execution>
<phase>package</phase>
<goals>
<goal>analyse</goal>
</goals>
</execution>

最佳答案

所以我们确实有一个分析 pom 的目标(我们将它放在父 pom 上)。这个分析只是确保我们不会在 sons pom.xml 中声明重复的东西。一旦我删除了重复项,一切就都构建好了。顺便说一句:通过删除这个目标,我也将获得成功。

关于java - 将 Jersey 从 1.x 迁移到 2.x 时出现编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34732073/

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