In a MAVEN project, different modules need to be compiled from different JDK

Source: Internet
Author: User

I am building a database partition, sub-table, due to JDBC3 (implemented in jdk1.5) and JDBC4 (implemented in the jdk1.6) there are considerable differences between the two specifications, resulting in no matter which JDK to compile, will lead to the entire Pom tree can not be built correctly, there is always a problem. said the actual problem card for a long time, and finally research maven compiled plug-ins, only to really solve.
The workaround is to define the following compilation plug-in in the main pom:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<build>
    [...]
    <plugins>
      <plugin>
         <groupid>org.apache.maven.plugins</groupid>
        < Artifactid>maven-compiler-plugin</artifactid>
        <version> 3.1</version>
        <configuration>
           <verbose>true</verbose>,
          <fork>true</ Fork>
          <executable>${jdk1.5javac}</executable>
          <compilerversion>1.5</compilerversion>
         </configuration>
      </plugin>
    </plugins>
    [...]
  </build>





Add the following compilation plug-in to DBCLUSTERJDBC4:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<build>
    [...]
    <plugins>
      <plugin>
         <groupid>org.apache.maven.plugins</groupid>
        < Artifactid>maven-compiler-plugin</artifactid>
        <version> 3.1</version>
        <configuration>
           <verbose>true</verbose>,
          <fork>true</ Fork>
          <executable>${jdk1.6javac}</executable>
          <compilerversion>1.6</compilerversion>
         </configuration>
      </plugin>
    </plugins>
    [...]
  </build>



Then define the Jdk1.5javac and Jdk1.6javac variables in the settings.xml and point to the Javac file for the two JDK.

In a MAVEN project, different modules need to be compiled from different JDK

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.