compiling project with jdk1.5 using maven2

旧街凉风 提交于 2019-12-01 19:01:42

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>

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:

  <parent>
    <groupId>com.foo.bar</groupId>
    <artifactId>reactor</artifactId>    
    <version>1.0-SNAPSHOT</version>
  </parent>

In the pom file of your reactor you have to put this:

<packaging>pom</packaging>

To let maven know that it's not a jar/war, etc.

Hope it helps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!