我需要将一个项目安装到我的本地存储库中。
期间mvn install
我遇到了编译错误。
> [INFO] --- maven-resources-plugin:2.3:resources (default-resources) @
> plant_store_sdk --- [WARNING] Using platform encoding (UTF-8 actually)
> to copy filtered resources, i.e. build is platform dependent! [INFO]
> skip non existing resourceDirectory
> /media/paddy/DATA/workspace/plant_store_sdk/src/main/resources [INFO]
> [INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) @
> plant_store_sdk --- [INFO] Compiling 8 source files to
> /media/paddy/DATA/workspace/plant_store_sdk/target/classes [INFO]
> ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO]
> ------------------------------------------------------------------------ [INFO] Total time: 1.163s [INFO] Finished at: Thu Jan 16 08:03:33 CET
> 2014 [INFO] Final Memory: 7M/188M [INFO]
> ------------------------------------------------------------------------ [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile
> (default-compile) on project plant_store_sdk: Compilation failure:
> Compilation failure: [ERROR]
> /media/paddy/DATA/workspace/plant_store_sdk/src/main/java/model/Kind.java:[9,5]
> error: annotations are not supported in -source 1.3
由于某种原因,maven 插件尝试使用 Java 1.3。
执行mvn -v
给了我这个结果:
paddy@paddy-laptop:~/workspace/plant_store_sdk$ mvn -version
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: /usr/local/jdk1.7.0_45/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.11.0-15-generic", arch: "amd64", family: "unix"
如何配置 maven 以运行注释?我尝试从 IntelliJ 安装此项目,但出现同样的错误。
谢谢,感谢您的帮助。
答案1
您需要修改pom.xml
并配置maven编译器插件。
例子:
<!-- language: lang-xml -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>