我使用Spring创建了两个项目:message-spring-boot-starter和message-app。
使用命令mvn clean install,我构建了项目message-spring-boot-starter的工件,它出现在本地m2存储库“com.Message-Start”中。
消息的Pom.xml -spring starter:
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.message-starter</groupId>
<artifactId>message-spring-boot-starter</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>message-spring-boot-starter</name>
<description>message-spring-boot-starter</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>消息的Pom.xml -app:
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>message-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>message-app</name>
<description>message-app</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.message-starter</groupId>
<artifactId>message-spring-boot-starter</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>我的结果是一个错误:Could not find artifact com.message-starter:message-spring-boot-starter:jar:unknown in central (https://repo.maven.apache.org/maven2)
我想将message-spring-boot-starter添加到message-app项目的依赖项中,但是每次都会收到这个错误。
请告诉我我做错了什么,以及如何解决
发布于 2022-11-26 20:13:48
您需要一个依赖项的version标记,该标记指定要拉的工件的版本。
<dependency>
<groupId>com.message-starter</groupId>
<artifactId>message-spring-boot-starter</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>https://stackoverflow.com/questions/74585262
复制相似问题