使用maven2编译项目与jdk1.5 [英] compiling project with jdk1.5 using maven2

查看:98
本文介绍了使用maven2编译项目与jdk1.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设法使用maven2创建我的项目结构。
,但是当我编译我的项目使用mvn install
获取错误
泛型在-source 1.3不支持

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构建我的项目使用jdk1.5和添加的构建标记

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>

但不起作用。

任何提示?

推荐答案

将maven-compiler-plugin添加到您的构建中:

Add the maven-compiler-plugin to your build:

<build>
  <plugins>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.0.2</version>
    <configuration>
        <source>1.5</source>
        <target>1.5</target>
    </configuration>
    </plugin>
  </plugins>
</build>

这篇关于使用maven2编译项目与jdk1.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆