Monday, October 14, 2013

Compile maven project for Java 1.4

I had problem with configuring maven. I want to compile some project to Java 1.4. After some I found following configuration which is really working:

<!--
  Strictly speaking, we did not need to generate this for you from
  the prototype, but we use it to illustrate how you can get
  the JDK 6 Java compiler to accept 1.5 or 1.6 targeted source code
  but produce class files that are compatible with JRE 1.4. As
  Michael Caine might not say, "Not a lot of people know that!"
  -->
<plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.0.2</version>
    <configuration>
        <source>1.6</source>
        <target>jsr14</target>
        <sourceDirectory>src</sourceDirectory>
    </configuration>
</plugin>

It's not my idea. I wrote down this example long time ago. Now I can't found place where I originally found it. Sorry.

No comments:

Post a Comment