使用maven2使用jdk1.5编译项目
我设法使用 maven2 创建我的项目结构。 但是当我使用 mvn install 编译我的项目时 出现错误 -source 1.3 不支持泛型,
用 google 搜索使用 jdk1.5 构建我的项目并添加了构建标签
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.myProject</groupId>
<artifactId>project</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>myapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.myProject</groupId>
<artifactId>project</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugins>
</build>
</project>
,但这不起作用。
有什么提示吗?
i managed to create my project structure using maven2.
but when am compiling my project using mvn install
getting error
generics are not supported in -source 1.3
googled to build my project using jdk1.5 and added build tag
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.myProject</groupId>
<artifactId>project</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>myapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.myProject</groupId>
<artifactId>project</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugins>
</build>
</project>
but this is not working.
Any hints?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将 maven-compiler-plugin 添加到您的构建中:
Add the maven-compiler-plugin to your build:
有一种“更简单”的方法可以完成此任务,而无需将相同的代码片段粘贴到整个模块中。 您可以设置一个反应器,然后从所有其他模块引用它,如下所示:
在反应器的 pom 文件中,您必须放置以下内容:
让 Maven 知道它不是 jar/war 等。
希望如此帮助
There's an "easier" way to accomplish this, without having to paste the same snippet all over your modules. You can set up a reactor and then you refer to it from all the other modules, like this:
In the pom file of your reactor you have to put this:
To let maven know that it's not a jar/war, etc.
Hope it helps