【发布时间】:2017-11-24 07:04:47
【问题描述】:
我正在尝试将我的版本从 pom.xml 移动到属性文件,但是这样做时,导入失败。
我的 pom.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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.trial</groupId>
<artifactId>books</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${basedir}/versions.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- SPRING -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${springframework.version}</version>
</dependency>
...
</dependencies>
</project>
虽然 pom.xml 上没有显示错误,但导入已经开始失败(当 pom.xml 上设置的属性时它工作正常):
import org.springframework.beans.factory.annotation.Autowired;
抛出:
错误:(6, 52) java: 包 org.springframework.beans.factory.annotation 不存在
versions.properties 看起来像:
springframework.version = 5.0.1.RELEASE
发生了什么事?我做错了什么?
非常感谢
【问题讨论】:
标签: maven jakarta-ee intellij-idea pom.xml maven-plugin