バージョンをpom.xmlからプロパティファイルに移動しようとしていますが、その際にインポートが失敗します。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;
はスロー:
012:Error:(6, 52) java: package org.springframework.beans.factory.annotation does not exist
versions.propertiesは次のようになります
springframework.version = 5.0.1.RELEASE
何が起こっているのですか?私は間違って何をしていますか?あなたはこのようなものを使用することができます知っている
どうもありがとう
可能な複製:https://stackoverflow.com/questions/40114869/maven-pom-file-externalizing-dependency-versions-to-a-properties-file –
[Maven:Pomファイル - 外部化依存バージョンプロパティファイル](https://stackoverflow.com/questions/40114869/maven-pom-file-externalizing-dependency-versions-to-a-properties-file) –