英文:
Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3
问题
我正在开发一个 Spring Boot 应用程序,其中有两个模块:pet-clinic-web 和 pet-clinic-data。目前除了在 pet-clinic-data 中的一些数据模型类之外,我还没有任何类或视图页面。我使用 Maven 作为我的依赖管理工具,我需要在终端上运行 "mvn release:prepare",但在过程中出现了错误。
**错误信息**
在项目 sfg-pet-clinic 上执行目标 org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) 失败:在反应堆项目列表中没有 SNAPSHOT 项目。
**项目 Maven 配置**
```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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<modules>
<module>pet-clinic-data</module>
<module>pet-clinic-web</module>
</modules>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<relativePath /> <!-- 从仓库中查找父项目 -->
</parent>
<groupId>gure.springframework</groupId>
<artifactId>sfg-pet-clinic</artifactId>
<version>0.0.5</version>
<name>sfg-pet-clinic</name>
<description>Demo project for Spring Boot</description>
<!-- 其他配置项 -->
</project>
pet-clinic-data 模块配置
<?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/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>sfg-pet-clinic</artifactId>
<groupId>gure.springframework</groupId>
<version>0.0.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pet-clinic-data</artifactId>
<properties>
<spring-boot.repackage.skip>true</spring-boot.repackage.skip>
</properties>
<!-- 依赖配置 -->
</project>
pet-clinic-web 模块配置
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>pet-clinic-web</artifactId>
<version>0.0.5</version>
<parent>
<artifactId>sfg-pet-clinic</artifactId>
<groupId>gure.springframework</groupId>
<version>0.0.5</version>
</parent>
<!-- 依赖配置 -->
</project>
项目结构
(参考图像,此处省略)
<details>
<summary>英文:</summary>
i am developing a spring-boot application which has a 2 module pet-clinic-web and pet-clinic-data right now i don't have any classes or view page except some data model class on my pet-clinic-data and i am using maven as my dependency management i need to do ``mvn release:prepare`` on the terminal but i have a error during a process
**error**
Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project sfg-pet-clinic: You don't have a SNAPSHOT project in the reactor projects list.
**project maven**
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<modules>
<module>pet-clinic-data</module>
<module>pet-clinic-web</module>
</modules>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>gure.springframework</groupId>
<artifactId>sfg-pet-clinic</artifactId>
<version>0.0.5</version>
<name>sfg-pet-clinic</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<goals>install</goals>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
</plugins>
</build>
<scm>
<developerConnection>scm:git:https://github.com/springframeworkguru/sfg-pet-clinic.git</developerConnection>
<tag>sfg-pet-clinic-0.0.5</tag>
</scm>
</project>
**pet-clinic data**
<?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/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>sfg-pet-clinic</artifactId>
<groupId>gure.springframework</groupId>
<version>0.0.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pet-clinic-data</artifactId>
<properties>
<spring-boot.repackage.skip>true</spring-boot.repackage.skip>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<!-- <dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<scope>runtime</scope>
</dependency>-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jdbc</artifactId>
</dependency>-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<!-- <execution>
<goals>
<goal>
repackage
</goal>
</goals>
<configuration>
<skip>
true
</skip>
</configuration>
</execution>-->
</executions>
</plugin>
</plugins>
</build>
</project>
**pet-clinic-web**
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>pet-clinic-web</artifactId>
<version>0.0.5</version>
<parent>
<artifactId>sfg-pet-clinic</artifactId>
<groupId>gure.springframework</groupId>
<version>0.0.5</version>
</parent>
<dependencies>
<dependency>
<artifactId>pet-clinic-data</artifactId>
<groupId>gure.springframework</groupId>
<version>0.0.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
**structure of my project**
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/AG6Vh.png
</details>
# 答案1
**得分**: 0
你试图发布的项目必须有一个SNAPSHOT版本。它应该是这个样子:
<version>X.X.X-SNAPSHOT</version>
<details>
<summary>英文:</summary>
The project that you are trying to release must have a SNAPSHOT version. It should look like this:
<version>X.X.X-SNAPSHOT</version>
</details>
# 答案2
**得分**: 0
以下是翻译好的内容:
不确定这是否会有帮助,因为我没有看到完整的错误信息,但我希望能够帮上忙。
1/ 去掉以下部分:
```xml
<properties>
<java.version>1.8</java.version>
</properties>
然后在根部添加以下内容:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<goals>install</goals>
</configuration>
</plugin>
<scm>
<developerConnection>scm:git:${git_url}</developerConnection>
<tag>HEAD</tag>
</scm>
2/ 运行命令:mvn clean
3/ 运行命令:mvn release:prepare
4/ 运行命令:mvn release:perform
英文:
there not sure if this will help because I didn't see the whole error but
I hope it does
1/get rid of
<properties>
<java.version>1.8</java.version>
</properties>
and add this to the root
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<goals>install</goals>
</configuration>
</plugin>
<scm>
<developerConnection>scm:git:${git_url}</developerConnection>
<tag>HEAD</tag>
</scm>
2/ do a mvn clean
3/ do mvn release:prepare
4/ do mvn release: perform
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论