IntelliJ 12.1.4とJava 7を使用してMaven 3.0.5でjarを作成しようとするとエラーが発生します。プロジェクトを実行できます私はそれをパッケージ化しようとすると、私は次のエラーが発生します。Mavenがエラーを返しました:-sourceでtry-with-resourcesがサポートされていません1.5
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>jar-with-dependencies</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
とエラーは、次のとおりです:
(Sonatype
でMaven By Example
から取られた)私のPOMの関連セクションはある
[ERROR] ...[33,55] error: diamond operator is not supported in -source 1.5
[ERROR] ...[207,7] error: try-with-resources is not supported in -source 1.5
[ERROR] ...[73,52] error: diamond operator is not supported in -source 1.5
[ERROR] ...[129,40] error: multi-catch statement is not supported in -source 1.5
[ERROR] ...[44,6] error: try-with-resources is not supported in -source 1.5
[ERROR] ...[28,39] error: diamond operator is not supported in -source 1.5
[ERROR] ...[31,7] error: try-with-resources is not supported in -source 1.5
[ERROR] ...[38,6] error: try-with-resources is not supported in -source 1.5
[ERROR] ...[34,41] error: diamond operator is not supported in -source 1.5
[ERROR] ...[77,43] error: diamond operator is not supported in -source 1.5
[ERROR] ...[84,6] error: try-with-resources is not supported in -source 1.5
[ERROR] ...[281,38] error: diamond operator is not supported in -source 1.5
[ERROR] ...[13,55] error: diamond operator is not supported in -source 1.5
[ERROR] ...[155,7] error: try-with-resources is not supported in -source 1.5
は、どのように私は、ソース1.7を使用するようにMavenを得ることができますか?
Mavenではこのエラーは発生しません。 Javaコンパイラはこれを行います。 – EJP
@EJPこの問題は、IDEAではなく、Mavenでコンパイルするときにのみ現れます。そのため、Mavenが疑わしいのです。ソースレベルのプロパティをPOMに追加すると、そのエラーが解決されました。これは、Mavenが問題の原因でもあることを示しています。それは、コンパイラを症状ではなく、原因にします。 –
コンパイラがバージョン7のときは、1.5(またはその5!)がデフォルトであり、7ではないことが完全にわかります。新しいバージョンではあまり信頼できません。 –