未解决的依赖:在Maven中的io.swagger:swagger-core:jar

huangapple go评论70阅读模式
英文:

unresolved dependency: io.swagger:swagger-core:jar in maven

问题

以下是您提供的内容的翻译部分:

我在尝试构建一个GitHub项目时遇到以下错误:
[![enter image description here][1]][1]

整个 POM 文件如下:

<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>org.nmdp</groupId>
    <artifactId>hml-fhir</artifactId>
    <packaging>jar</packaging>
    <version>2.0.0-SNAPSHOT</version>

    <!-- 其他属性设置 -->

    <build>
        <!-- 构建设置,包括插件配置 -->
    </build>

    <!-- 其他配置,如仓库、依赖管理等 -->

</project>

在这里,有一个依赖关系问题,具体来说,只有一个依赖似乎有问题:

[![enter image description here][3]][3]

我尝试从依赖管理器手动复制粘贴这两个依赖项,但没有成功。
我还尝试将它们删除,仍然没有解决问题,以防依赖于依赖管理器已经足够。

正如您所看到的,我还使用 jitpack.io 来获取 GitHub 上另一个项目的依赖关系。不确定这是否是最佳方法。

问题究竟是什么?我哪里理解错了?如何纠正?

请注意,由于您的要求,我只翻译了给定的文本,不做其他回答。如果您有任何进一步的问题或需要更多帮助,请随时提问。

英文:

I face the following error when trying to build a github project:
未解决的依赖:在Maven中的io.swagger:swagger-core:jar

The whole pom looks like this:

&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;
xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd&quot;&gt;
&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
&lt;groupId&gt;org.nmdp&lt;/groupId&gt;
&lt;artifactId&gt;hml-fhir&lt;/artifactId&gt;
&lt;packaging&gt;jar&lt;/packaging&gt;
&lt;version&gt;2.0.0-SNAPSHOT&lt;/version&gt;
&lt;properties&gt;
&lt;swagger-codegen-version&gt;2.2.2&lt;/swagger-codegen-version&gt;
&lt;maven-compiler-plugin-version&gt;3.5.1&lt;/maven-compiler-plugin-version&gt;
&lt;mapstruct-core-version&gt;1.2.0.Beta1&lt;/mapstruct-core-version&gt;
&lt;maven-clean-plugin-version&gt;2.6.1&lt;/maven-clean-plugin-version&gt;
&lt;mongodb-version&gt;3.4.0&lt;/mongodb-version&gt;
&lt;log4j-version&gt;1.2.17&lt;/log4j-version&gt;
&lt;model-mapper-version&gt;0.7.5&lt;/model-mapper-version&gt;
&lt;nmdp-models-version&gt;2.0.0&lt;/nmdp-models-version&gt;
&lt;gson-version&gt;2.8.0&lt;/gson-version&gt;
&lt;commons-io-version&gt;1.4&lt;/commons-io-version&gt;
&lt;joda-time-version&gt;2.9.9&lt;/joda-time-version&gt;
&lt;json-version&gt;20160212&lt;/json-version&gt;
&lt;commons-lang-version&gt;3.1&lt;/commons-lang-version&gt;
&lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
&lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
&lt;java.version&gt;1.8&lt;/java.version&gt;
&lt;/properties&gt;
&lt;build&gt;
&lt;sourceDirectory&gt;src/main/java&lt;/sourceDirectory&gt;
&lt;plugins&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
&lt;version&gt;${maven-compiler-plugin-version}&lt;/version&gt;
&lt;configuration&gt;
&lt;source&gt;${java.version}&lt;/source&gt;
&lt;target&gt;${java.version}&lt;/target&gt;
&lt;annotationProcessorPaths&gt;
&lt;path&gt;
&lt;groupId&gt;org.mapstruct&lt;/groupId&gt;
&lt;artifactId&gt;mapstruct-processor&lt;/artifactId&gt;
&lt;version&gt;${mapstruct-core-version}&lt;/version&gt;
&lt;/path&gt;
&lt;/annotationProcessorPaths&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
&lt;plugin&gt;
&lt;artifactId&gt;maven-clean-plugin&lt;/artifactId&gt;
&lt;version&gt;${maven-clean-plugin-version}&lt;/version&gt;
&lt;configuration&gt;
&lt;excludeDefaultDirectories&gt;true&lt;/excludeDefaultDirectories&gt;
&lt;filesets&gt;
&lt;fileset&gt;
&lt;directory&gt;${project.build.directory}&lt;/directory&gt;
&lt;excludes&gt;
&lt;exclude&gt;generated-sources/swagger/.swagger-codegen-ignore&lt;/exclude&gt;
&lt;/excludes&gt;
&lt;/fileset&gt;
&lt;/filesets&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/build&gt;
&lt;repositories&gt;
&lt;repository&gt;
&lt;id&gt;jitpack.io&lt;/id&gt;
&lt;url&gt;https://jitpack.io&lt;/url&gt;
&lt;/repository&gt;
&lt;/repositories&gt;
&lt;dependencyManagement&gt;
&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.mongodb&lt;/groupId&gt;
&lt;artifactId&gt;mongo-java-driver&lt;/artifactId&gt;
&lt;version&gt;${mongodb-version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;log4j&lt;/groupId&gt;
&lt;artifactId&gt;log4j&lt;/artifactId&gt;
&lt;version&gt;${log4j-version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;io.swagger&lt;/groupId&gt;
&lt;artifactId&gt;swagger-core&lt;/artifactId&gt;
&lt;version&gt;${swagger-version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;io.swagger&lt;/groupId&gt;
&lt;artifactId&gt;swagger-annotations&lt;/artifactId&gt;
&lt;version&gt;${swagger-version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.json&lt;/groupId&gt;
&lt;artifactId&gt;json&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.mapstruct&lt;/groupId&gt;
&lt;artifactId&gt;mapstruct&lt;/artifactId&gt;
&lt;version&gt;${mapstruct-core-version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.modelmapper&lt;/groupId&gt;
&lt;artifactId&gt;modelmapper&lt;/artifactId&gt;
&lt;version&gt;${model-mapper-version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.nmdp&lt;/groupId&gt;
&lt;artifactId&gt;service-hml-fhir-converter-models&lt;/artifactId&gt;
&lt;version&gt;${nmdp-models-version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
&lt;artifactId&gt;gson&lt;/artifactId&gt;
&lt;version&gt;${gson-version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;commons-io&lt;/groupId&gt;
&lt;artifactId&gt;commons-io&lt;/artifactId&gt;
&lt;version&gt;${commons-io-version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;joda-time&lt;/groupId&gt;
&lt;artifactId&gt;joda-time&lt;/artifactId&gt;
&lt;version&gt;${joda-time-version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.json&lt;/groupId&gt;
&lt;artifactId&gt;json&lt;/artifactId&gt;
&lt;version&gt;${json-version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
&lt;artifactId&gt;commons-lang3&lt;/artifactId&gt;
&lt;version&gt;${commons-lang-version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;/dependencyManagement&gt;
&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.mongodb&lt;/groupId&gt;
&lt;artifactId&gt;mongo-java-driver&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;log4j&lt;/groupId&gt;
&lt;artifactId&gt;log4j&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.mapstruct&lt;/groupId&gt;
&lt;artifactId&gt;mapstruct&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.modelmapper&lt;/groupId&gt;
&lt;artifactId&gt;modelmapper&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;com.github.nmdp-bioinformatics&lt;/groupId&gt;       
&lt;artifactId&gt;service-hml-fhir-converter-models&lt;/artifactId&gt;
&lt;version&gt;-SNAPSHOT&lt;/version&gt;                              //ONLY ERROR APPEARS HERE
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
&lt;artifactId&gt;gson&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;commons-io&lt;/groupId&gt;
&lt;artifactId&gt;commons-io&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;joda-time&lt;/groupId&gt;
&lt;artifactId&gt;joda-time&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.json&lt;/groupId&gt;
&lt;artifactId&gt;json&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
&lt;artifactId&gt;commons-lang3&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;

</project>

I don't have any experience when it comes to dependencies, but I understood some basics from this post:
https://stackoverflow.com/questions/2619598/differences-between-dependencymanagement-and-dependencies-in-maven.

I think this issued is faced here again but I couldn't translate the solution to my own issue: https://stackoverflow.com/questions/52392273/maven-package-io-swagger-annotations-does-not-exist

The maven window looks like this:

未解决的依赖:在Maven中的io.swagger:swagger-core:jar

And more precisely, only one dependency seems to be problematic:

未解决的依赖:在Maven中的io.swagger:swagger-core:jar

I tried to manually copy paste from the dependencyManager the two dependencies, but it didn't work.
I also tried to remove them , still without solving the issue, in case the dependency on the dependencyManager was enough.

As you can see I am also using jitpack.io to get the dependency of another project in github. Not sure if this is the best approach.

What is exactly the mistake? What am I understanding wrong, and how can I correct it?

答案1

得分: 1

${swagger-version} 在 properties 标签中似乎缺失,但被使用了两次。

尝试将此属性设置为特定版本,

或从使用它的两个依赖项中将其移除。(如果存在父 POM 或其他 JAR 文件,在构建项目时 Maven 可能会查找版本,因此移除它可能有效)

英文:

${swagger-version} seems to be missing in the properties tag but used twice.

Try setting this property to a specific version

or removed this from both the dependencies where used. (Removing this may work in case there is a parents pom or some other jar which would be looked up for version by maven while building your project)

huangapple
  • 本文由 发表于 2020年10月21日 21:33:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/64464691.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定