英文:
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:
The whole pom looks like this:
<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>
<properties>
<swagger-codegen-version>2.2.2</swagger-codegen-version>
<maven-compiler-plugin-version>3.5.1</maven-compiler-plugin-version>
<mapstruct-core-version>1.2.0.Beta1</mapstruct-core-version>
<maven-clean-plugin-version>2.6.1</maven-clean-plugin-version>
<mongodb-version>3.4.0</mongodb-version>
<log4j-version>1.2.17</log4j-version>
<model-mapper-version>0.7.5</model-mapper-version>
<nmdp-models-version>2.0.0</nmdp-models-version>
<gson-version>2.8.0</gson-version>
<commons-io-version>1.4</commons-io-version>
<joda-time-version>2.9.9</joda-time-version>
<json-version>20160212</json-version>
<commons-lang-version>3.1</commons-lang-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin-version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct-core-version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven-clean-plugin-version}</version>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>${project.build.directory}</directory>
<excludes>
<exclude>generated-sources/swagger/.swagger-codegen-ignore</exclude>
</excludes>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>${mongodb-version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j-version}</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-core</artifactId>
<version>${swagger-version}</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-version}</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${mapstruct-core-version}</version>
</dependency>
<dependency>
<groupId>org.modelmapper</groupId>
<artifactId>modelmapper</artifactId>
<version>${model-mapper-version}</version>
</dependency>
<dependency>
<groupId>org.nmdp</groupId>
<artifactId>service-hml-fhir-converter-models</artifactId>
<version>${nmdp-models-version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson-version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io-version}</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda-time-version}</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>${json-version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang-version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
</dependency>
<dependency>
<groupId>org.modelmapper</groupId>
<artifactId>modelmapper</artifactId>
</dependency>
<dependency>
<groupId>com.github.nmdp-bioinformatics</groupId>
<artifactId>service-hml-fhir-converter-models</artifactId>
<version>-SNAPSHOT</version> //ONLY ERROR APPEARS HERE
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
</dependencies>
</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:
And more precisely, only one dependency seems to be problematic:
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)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论