【发布时间】:2021-08-22 07:54:26
【问题描述】:
我采用了一个较旧的 Java 11、基于 Spring 的多模块项目,大约两年以来我一直没有从事该项目,并试图让它在我的新笔记本电脑上编译和运行。它可以在我的旧笔记本电脑上运行,但我无法让它在新笔记本电脑上运行。运行 mvn clean install 时,名为“util”的模块编译得很好。但是需要“util”模块的“shared”模块找不到util模块:“找不到符号”。发生的情况是所有 fxml 和图像文件都被复制到目标目录,但没有一个类文件。因为在 STS(Spring 开发工具)中有关该问题的信息非常有限,所以我安装了 Maven 3.8.2。并尝试从命令行修复它。根据我在互联网上找到的信息和内容,我添加了 org.codehaus.mojoversions-maven-plugin 和 org.apache.maven.plugins:maven-enforcer-plugin 加上我尝试使用和不使用显式版本标签,因为我收到了警告因为这些版本已经在 spring-boot-dependencies-2.5.4.pom.pom 中定义了。因此,当我运行 mvn versions:display-plugin-updates 时,我发现结果非常混乱,因为最后它显示“BUILD SUCCESS”,但如果我向上滚动,则会出现一条错误消息:“项目未定义必需Maven 的最低版本。更新 pom.xml 以包含 maven-enforcer-plugin 以强制构建此项目所需的 maven 版本。但这就是我做的?! 请参阅下面的当前父 pom。如果您需要更多信息,请告诉我。预先感谢您的帮助。 请记住,我在 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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.4</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.agiletunes</groupId>
<artifactId>agiletunes-parent</artifactId>
<version>0.0.1</version>
<packaging>pom</packaging>
<name>agiletunes-parent</name>
<description>Maven parent for all agileTunes modules</description>
<modules>
<module>../agiletunes-productmanager</module>
<module>../agiletunes-testmanager</module>
<module>../agiletunes-shared</module>
<module>../agiletunes-authserver</module>
<module>../agiletunes-util</module>
</modules>
<properties>
<java.version>11</java.version>
<maven.compiler.release>11</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- for testing Spring Boot applications with JUnit -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.openjfx/javafx -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>11</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.5</version>
<configuration>
<generateBackupPoms>false</generateBackupPoms>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.0</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
【问题讨论】:
-
请在您的“Textwüste” ;) 开头添加格式和分节符。否则,对于每个未来的读者/寻求者来说,很难一目了然地了解这个问题的详细内容。
标签: java spring-boot maven maven-3 maven-plugin