4960 次
3 に答える
14
http://maven.apache.org/general.html#Compiling-J2SE-5
選択したターゲットおよびソース JVM でコンパイルできるように Maven をセットアップするにはどうすればよいですか? pom でソース パラメータとターゲット パラメータを設定する必要があります。たとえば、ソースとターゲットの JVM を 1.5 に設定するには、pom に以下を含める必要があります。
...
<build>
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
...
</build>
...
于 2011-12-14T05:33:45.890 に答える
1
POM ファイルを確認します。おそらく、Maven に Java 1.3 を使用するように指示するコンパイラ プラグインのプラグイン構成があるはずです。詳しくはこちらのページをご覧ください。
于 2011-12-14T05:34:39.737 に答える
1
ファイルを確認し、POM
以下のようにコンパイラのバージョンを追加してください。
<project>
[...]
<build>
[...]
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<executable><!-- path-to-javac --></executable>
<compilerVersion><!-- compiler-version --></compilerVersion>
</configuration>
</plugin>
</plugins>
[...]
</build>
[...]
</project>
Javaパスのハードコーディングを避けるために、以下のように実行可能にします。
<executable>${JAVA_1_5_HOME}/bin/javac</executable>
サーバーのSettings.xmlに移動し、以下のようなプロファイルを作成します。
<settings>
[...]
<profiles>
[...]
<profile>
<id>compiler</id>
<properties>
<JAVA_1_5_HOME>C:\Program Files\Java\j2sdk1.5.2_09</JAVA_1_5_HOME>
</properties>
</profile>
</profiles>
[...]
<activeProfiles>
<activeProfile>compiler</activeProfile>
</activeProfiles>
</settings>
JAVA_HOMEを検出するのに役立ちます。
于 2011-12-14T05:47:07.747 に答える