How-to integrate latest Groovy (2.4) with latest Netbeans (8.2)? - java

This question follows-on from notes against Netbeans v8.0.1.
Wondering how to use Groovy 2.3 with Netbeans 8?
This question is now critical since I began using Spock for Java testing since it is Groovy based.
I like Spock and I'd prefer to work with the same Groovy version within Netbeans, as I use with Gradle and on the command line.
Also, I am using sdkman which means that the "working" Groovy version can swap depending on which project or which version of a package I need to work on. In short I want Netbeans to work with ...
current Groovy version
At present ...
$ groovy -version
Groovy Version: 2.4.7 JVM: 1.8.0_102 Vendor: Oracle Corporation OS: Linux
$
$ gradle -version
------------------------------------------------------------
Gradle 3.1
------------------------------------------------------------
Build time: 2016-09-19 10:53:53 UTC
Revision: 13f38ba699afd86d7cdc4ed8fd7dd3960c0b1f97
Groovy: 2.4.7
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_102 (Oracle Corporation 25.102-b14)
OS: Linux 4.4.0-36-generic amd64
And when the Groovy and Gradle project runs on the command-line...
$ gradle build
Starting a Gradle Daemon (subsequent builds will be faster)
Gradle version: 3.1
Groovy version: 2.4.7
Java version: 1.8.0_102
:compileJava
:compileGroovy
...
Running the same Gradle build.gradle project within Netbeans:
Executing: gradle build
Arguments: [-u]
Gradle version: 3.1
Groovy version: 2.4.4
Java version: 1.8.0_102
:compileJava UP-TO-DATE
:compileGroovy UP-TO-DATE
At present I have NO idea where v2.4.4 Groovy came from! Although I am formulating an uncomfortable hypothesis which I'll plonk at the end.
With Netbeans there seem to be two different problems which I'll cover separately. I will take the second point first, as it probably impacts the point #1 more than we realise..
Inconsistent Groovy packaging and support
Ineffective configuration-method to select/use a specific Groovy platform or version.
1. Inconsistent Groovy configuration
The documented Groovy configuration process
Advice seems to believe that just changing the Groovy library to the latest groovy-all.jar is enough
http://www.areaofthoughts.com/2011/11/upgrading-groovy-in-netbeans-ide-71.html
https://netbeans.org/features/groovy/
This hasn't worked very well at all judging by the relevant questions/comments out there ...
How to use Groovy 2.0 in netbeans
a bit of googling gets you over 10,000 hits and
quite a few on the first page seem to be active bugs.
A mythbuster ... I have been adding this snippet to Groovy and Gradle scripts
println "Gradle version: "+ gradle.gradleVersion;
println "Groovy version: "+ GroovySystem.version;
println "Java version: "+ System.getProperty("java.version");
The output when running with netbeans 8.2 on Windows and Linux is curious.
Groovy version: 2.1.3
Java version: 1.8.0_102
I was thinking v2.1.3 is the groovy-all JAR file that comes with Netbeans -- how silly of me:
The Netbeans log show me that the Groovy module loaded was:
"Groovy 2.1.7"
jar:nbinst://org.netbeans.modules.libs.groovy/modules/ext/groovy-all.jar!/
I checked that JAR, and this JAR file reports its version 2.4.5:
$ java -jar /opt/dev/netbeans/home/groovy/modules/ext/groovy-all.jar -version
Groovy Version: 2.4.5 JVM: 1.8.0_102 Vendor: Oracle Corporation OS: Linux
Where does Groovy v2.1.3 come from? I accidentally found that too. I swapped out the bundled (and mislabelled in libraries) v2.1.7 JAR file with the current embedded groovy-all (v2.4.7).
When I started Netbeans 8.2 ... I ran my Groovy main program:
Gradle version: 3.1
Groovy version: 2.1.3
Java version: 1.8.0_102
Huh! No difference ... Now. Look at the output from a Gradle build under Netbeans (which also runs a Groovy run-time...):
Executing: gradle build
Arguments: [-u]
Gradle version: 3.1
Groovy version: 2.4.4
Java version: 1.8.0_102
:compileJava UP-TO-DATE
:compileGroovy
Summarising; Netbeans appears to embody the following Groovy run-time versions:
2.1.3
2.1.7
2.4.4
2.4.5
And even though I have established a groovy library as: groovy-all-2.4.7.jar and put this JAR into the Netbeans Groovy modules area:
/opt/dev/netbeans/home/groovy/modules/ext
groovy-all.jar
# After copying the embeddable/groovy-all-2.4.7.jar
# into Netbeans Groovy/modules ...
#
$ java -jar /opt/dev/netbeans/home/groovy/modules/ext/groovy-all.jar -version
Groovy Version: 2.4.7 JVM: 1.8.0_102 Vendor: Oracle Corporation OS: Linux
Still NO scripts report the Groovy version as: 2.4.7.
To mis-quote The Princess Bride, "Groovy integration with Netbeans ... You seem to use this word alot.
"I don't think you know what it means."
2. Groovy packaging with Netbeans
As a counter point; I found the Gradle configuration ... These language/platform configurations can suit my needs:
Gradle (qualified)
Maven
Javascript
JRuby and Ruby
Java
Things that don't work well in a Netbeans context are:
Scala
Gradle (not integrated)
Groovy
Ant (yes)
Why can't Netbeans support a "Groovy platform" across all components and activities?!
Good examples for Groovy would be to look at how Netbeans supports:
Java platforms
Maven
Gradle - while clumsy imho, it works
Whereas Groovy appears to be all over the place. Clearly the use of Library functionality is NOT working.
I want some consistent Groovy language operation with Netbeans. It this means I need to fiddle with Bundles and get down and dirty, then may be that's a good thing because what I'm experiencing is Unsatisfactory.
hypothesis:
IDEA, Eclipse and Netbeans are using OSGi for component assembly.
It looks to me as if individual plug-ins or simple build packages are including their own Groovy package.
That can be a good thing for something that isn't meant to interact with projects or developers.
From my perspective I think it would be better if Groovy was a First Class language. So there is ONLY ONE Groovy version working at any particular time.
So that groovy based tooling like (say) Gradle, Spock and Groovy scripting are ALL the SAME Groovy run-time, same AST and on and on.
Hopefully the Stackoverflow collective have enough insight to identify methods to get things happening better.

On your project node, right click and choose Properties from the menu. Choose the Libraries category. In the Compile tab, you'll see under Compile-time Libraries: "Groovy 2.1.7". Select it, and click "Edit". In the Classath tab, you'll see under Library Classpath that it refers to a groovy-all.jar under the NetBeans installation directory.
In my preferred groovy installation at /usr/share/groovy, I found an alternative jar file at embeddable/groovy-all.jar. By removing the existing Library Classpath and replacing it with this one, you can compile your project to using Groovy 2.4.12.

Related

SpringBoot has an issue creating bean with MongoDB Java ClassFile Version [duplicate]

While running a script, I am getting the following error message in the Eclipse console:
Class has been compiled by a more recent version of the Java Environment (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0.
Java Version: 8
IDE: Eclipse Oxygen
Firefox Version: 46
This is just a version mismatch. You have compiled your code using java version 9 and your current JRE is version 8. Try upgrading your JRE to 9.
49 = Java 5
50 = Java 6
51 = Java 7
52 = Java 8
53 = Java 9
54 = Java 10
55 = Java 11
56 = Java 12
57 = Java 13
58 = Java 14
59 = Java 15
60 = Java 16
61 = Java 17
62 = Java 18
63 = Java 19
IDE: Eclipse Oxygen.3
To temporarily correct the problem do the following:
Project menu > Properties > Java Compiler > Compiler compliance level > 1.8
A permanent fix likely involves installing JDK 9.
FYI 1.8 is what Java 8 is called.
Side bar
I recently returned to Java after a foray into C# (a breath of fresh air) and installed Eclipse Oxygen onto a clean system that had never had Java installed on it before. This default everything with a brand new install of Eclipse Oxygen yet somehow or other Eclipse can't get its own parameters to match the jdk that's installed. This is the second project I created and the second time I ran into this headache. Time to go back to C#?
Related Question
has been compiled by a more recent version of the Java Runtime (class file version 53.0)
You might see this error in IntelliJ as well and this comes up in Google.
I think it's a Gradle error more than an IDE error.
The fix (stolen from here) is configure Java 11 as a Gradle JVM in IntelliJ:
File -> Settings -> Build, Execution & Development -> Build Tools -> Gradle and change Gradle JVM to 11
That screenshot stolen from the Jetbrains issue as well
You can try this way
javac --release 8 yourClass.java
For Android Studio, File -> Project Structure [Ctrl + Alt + Shift + S]
53 stands for java-9, so it means that whatever class you have has been compiled with javac-9 and you try to run it with jre-8. Either re-compile that class with javac-8 or use the jre-9
For temporary solution just right click on Project => Properties => Java compiler => over there please select compiler compliance level 1.8 => .class compatibility 1.8 => source compatibility 1.8.
Then your code will start to execute on version 1.8.
I had a similar issue from the console after building a Jar in Intellij. Using the Java configuration to update to a newer version (Windows -> Configure Java -> Update -> Update Now) didn't work and stuck at version 1.8 (Java 8).
To switch to a more recent version locally I had to install the Java 15 JDK from https://www.oracle.com/uk/java/technologies/javase-jdk15-downloads.html and add that to my Java runtime environment settings.
The solution for me was doing what Andrei Kuznetsov said at https://youtrack.jetbrains.com/issue/IDEA-251407/Failed-to-run-Android-project-in-the-Idea-20203-EAP-OutputBuildAction-has-been-compiled-by-a-more-recent-version-of-the-Java, summarized in the following image:
"Root cause: IDEA sources are now compiled against Java 11. Known workaround is to configure Java 11 as a Gradle JVM." (Andrei Kuznetsov)
Your JDK version: Java 8
Your JRE version: Java 9
Here your JRE version is different than the JDK version that's the case. Here you can compile all the java classes using JDK version 1.8. If you want to compile only one java class just change the *.java into <yourclassname>.java
javac -source 1.8 -target 1.8 *.java
source: The version that your source code requires to compile.
target: The oldest JRE version you want to support.
I'm writing this because I found the other answers hard to understand.
Essentially your JRE is not updated and/or Eclipse is not configured to use the most recent JRE.
On Windows, go to Control Panel -> Programs -> Java -> update and proceed to update java
or if you don't have Java, go to Oracle's website and download the most recent JRE.
Once this is done, go into eclipse, and under the project view, right click on your project, select Java Build Path, double click on JRE System Library, then Select Workspace Default JRE 14.1.
If a recent version of Java doesn't show up here, it probably isn't installed. Check you JRE(NOT JDK) version and make sure it's recent. If it is, try restarting the computer then trying this again.
IDE : Eclipse 2021-09
This is caused because you have compiled the code with java version 9 and have java8 installed. You don't have to update to solve this issue.
Right click on project > properties > Java Compiler > untick-Enable
project specific settings > configure workspace settings > tick-Use
default compliance settings > Apply and Close.
Now your code should be executed properly.
I've reproduced on Windows 10 the similar issue in format like:
Error: LinkageError occurred while loading main class ...
java.lang.UnsupportedClassVersionError: com/.../ServiceApplication
has been compiled by a more recent version of the Java Runtime (class file version 62.0),
this version of the Java Runtime only recognizes class file versions up to 61.0
after upgrading the project from Java 17 to Java 18.
I had project settings regarding to Java 18:
Command line:
java version "18.0.1.1" 2022-04-22
Java(TM) SE Runtime Environment (build 18.0.1.1+2-6)
Java HotSpot(TM) 64-Bit Server VM (build 18.0.1.1+2-6, mixed mode, sharing)
Project Structure -> Project Settings -> Project:
Project Structure -> Project Settings -> Modules:
Project Structure -> Platform Settings -> SDKs:
And the reason of this issue was:
I forgot to specify the correct version for Run/Debug Configurations -> Build and run to Java 18 instead of Java 17:
As it was compiled with a newer Java version, but running on the older one.
If it's Maven-related issue, you can modify POM by specifying the -source and -target of the Java Compiler.
Additional helpful links:
Setting the Java Version in Maven
Consuming Jar Artifact of a Specific Java Version
Go to Project section, click on properties > then to Java compiler > check compiler compliance level is 1.8 , or there should be no yellow warning at bottom
Refreshing gradle dependencies works for me: Right click over the project -> Gradle -> Refresh Gradle Project.
You should check your Project Facets.
Project Properties > Project Facets
Change java version to the same version you are using. That work for me!
I faced this error in Intellij. Apparently, choosing java 1.8 as the project SDK doesn't affect the javac compiler that's used to build the project.
To change that, go to Settings -> Build, Execution, Deployment -> Compiler -> Java Compiler, and change Project bytecode version to 8.
If you're using IntelliJ IDEA and having this error, try this.
Command + , (Open Preferences)
Build, Execution, Deployment > Build Tools > Gradle
Gradle JVM > Change it to a proper version
This is getting as an example
if your computer running on an older version of java and the Neo4J is compiled on the latest version, please try to install the same version or upper to your computer.
I'm getting the same problem with Sonarqube
has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Sonarqube with AzureDevOps error output:
INFO: SonarScanner 4.6.2.2472
INFO: Java 1.8.0_231 Oracle Corporation (32-bit)
INFO: Windows Server 2016 10.0 x86
INFO: User cache: C:\Windows\system32\config\systemprofile.sonar\cache
INFO: Scanner configuration file: C:\agent_a_work_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.4.0\classic-sonar-scanner-msbuild\sonar-scanner-4.6.2.2472\bin..\conf\sonar-scanner.properties
INFO: Project root configuration file: C:\agent_a_work\189.sonarqube\out\sonar-project.properties
INFO: Analyzing on SonarQube server 9.4.0
INFO: Default locale: "en_AU", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 0.405s
INFO: Final Memory: 3M/15M
##[error]ERROR: Error during SonarScanner execution
java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
I had Java v11 installed on the Sonarcube server, but the error is saying its the Build Agent that doesn't have Java v11.
I decided to add the Java v12 bin path to the Environment Variable Path for it to be detected. IMPORTANT THIS NEEDS TO BE DONE ON THE BUILD AGENT:
For a Hosted Build Agent you can install JDK v11 or use this PowerShell script step:
- task: PowerShell#2
displayName: 'Download and Install Java v11'
inputs:
targetType: 'inline'
script: |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$Command = "c:\jdk-11.0.15_windows-x64_bin.exe"
$Parms = "/s"
Write-Host [System.IO.File]::Exists($Command)
if ([System.IO.File]::Exists($Command)) {
Write-Host 'Downloading Java11.exe'
Invoke-WebRequest https://yourOwnUrl.com/jdk-11.0.15_windows-x64_bin.exe -OutFile $Command
}
Write-Host [System.IO.File]::Exists($Command)
& "$Command" $Prms
[System.Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\Program Files\Java\jdk-11.0.15")
[System.Environment]::SetEnvironmentVariable("Path", [System.Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::Machine) + ";$($env:JAVA_HOME)\bin")
In my case, I'm building with VS2019 some C++ code that is using ANTLR4.
ANTLR4 is java based, and to use it I run java commands as a custom build step.
Earlier that day I had updated my JRE (Java Runtime Environment) on my new laptop to 1.8. Not thinking, since it's been a year since I ran ANTLR4 stuff... I need the full JDK to COMPILE with java. So I had a 1.8 RUNTIME, but the VS2019 build shell was finding the JDK1.7 compiler. Once I installed the 1.8 JDK, all was good.
So 80% of the time JRE is fine for me... it's just when I need the full JDK, DOH I need the full JDK.
In build.gradle(app) update as below: (Worked for me)
kotlinOptions {
jvmTarget = '1.8'
}
For me this problem was resolved by just installing older version of testng. Looks like It compiles with my Java 8
If you're using IntelliJ IDEA and having this error, try this.
1. Command + , (Open Preferences)
2. Build, Execution, Deployment > Build Tools > Gradle
3. Gradle JVM > Change it to a proper version
Check the version of Java configured in IDE by navigating to Settings -> Build, Execution, Deployment > Build Tools > Gradle
In my case, I use the IntellJ Idea and set JDK11 as my SDK and JDK17 in gradle setting.
Just update my SDK as JDK17, it was solved
Check the JDK in "Project Setting"(CMD+;) -> SDK
with
the gradle JVM in "Preference"(CMD+,) -> Build Tools -> gradle JVM
Faced the same issue when initialise my project from spring initizer
We need to match the version of java.sourceCompatibility and jvmTarget used for run and compile in "build.gradle.kt" file.
Last week, I updated my Mac's Android Studio from 2021.2.1 to 2021.3.1. Then our project was built failed for the similar reason:
Cause: com/android/tools/idea/gradle/run/OutputBuildAction has been
compiled by a more recent version of the Java Runtime (class file
version 55.0), this version of the Java Runtime only recognizes class
file versions up to 53.0
I found several discussion on the Jetbrains YouTrack Forum: Failed to run Android project in the Idea 2020.3 EAP (OutputBuildAction has been compiled by a more recent version of the Java Runtime (class file version 55.0)). The suggested workaround is to update the defined Gradle JDK version to JDK11, but many Android projects don't support Gradle JDK11, so does mine.
Another solution is to downgrade Android Studio from 2021.3.1 to 2021.2.1, and it worked for me. Hope it helps.
it looks like everyone is using windows for development, but if you use Linux, lower your Java version. maybe install JDK 8, the version table provided by #Nithin should give you an idea of which version you want to install.
After configuring the version of the compiler to 1.8 (your required version), try the older version of spring boot currently it is 3.0.0 by default but you can try 2.7.6 instead.
enter image description here

NetBeans 12.4 "Warning - could not install some modules: JavaFX wrapper"

I get the following message after exiting out of NetBeans and then re-starting.
Warning - could not install some modules: JavaFX wrapper - No module providing the capability org.openide.modules.jre.JavaFX could be found. Another module could not be installed due to the above problems.
I am using Java 15, with JavaFX. I didn't have the issue with 12.3 and Java 15, but now I get it at least once a day, depending on how often I leave and re-enter.
I have a work-around. I replace the NetBeans cache with a clean copy kept for this purpose, and I can then restart and continue working without the error, but this is a bit tedious after the first couple of times, each day.
Product Version: Apache NetBeans IDE 12.4
Java: 15.0.4; OpenJDK 64-Bit Server VM 15.0.4+5-MTS
Runtime: OpenJDK Runtime Environment 15.0.4+5-MTS
System: Windows 10 version 10.0 running on amd64; UTF8; en_AU (nb)
I have found the solution, I have re-installed, and skipped the installation of the nb-javac plugin. I had forgotten that I did this on my older installations, until I re-read the post below. Everything is fine now.
NetBeans plugin fails if nb-javac installed
What's "nb-javac" in Apache NetBeans?

Gradle ignoring gradle.properties

I'm just starting out with Gradle and am almost certainly missing something obvious. My system has Java 7 installed as the default but I want all my Gradle projects to be using Java 8 by default. So, I create a ~/gradle.properties file and put the following in it:
$ cat ~/gradle.properties
org.gradle.java.home = /usr/lib/jvm/java-8-openjdk-amd64
But that doesn't appear to be honored. First, if I try to build my project I get:
Execution failed for task ':compileJava'.
> invalid source release: 1.8
Also, gradle --version gives:
$ gradle --version
------------------------------------------------------------
Gradle 1.5
------------------------------------------------------------
Gradle build time: Wednesday, October 8, 2014 8:21:39 AM UTC
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.9.4 compiled on October 7 2014
Ivy: non official version
JVM: 1.7.0_79 (Oracle Corporation 24.79-b02)
OS: Linux 3.16.0-4-amd64 amd64
However, if I copy ~/gradle.properties to my project directory (the directory with the build.gradle file) or if I run JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 gradle assemble it works. So there's not a syntax error or anything in my gradle.properties file and the JDK path is correct. For some reason the properties file is ignored if it's in my home dir.
Note that I don't have a gradle.properties in my project directory and I also tried putting the file in ~/.gradle/gradle.properties. I also did a bunch of Google and StackOverflow search and just can't find an answer to this seemingly obvious question.
Long story short, gradle reads gradle.properties from ~/.gradle/gradle.properties not ~/gradle-properties and the docs are pretty clear about that. In short, I'm a knuckle-head.

executing ant clean, Build Failed, Wrong java Version

I am trying to install hybris, but while installing I face a problem in executing ant clean command.
I am using the latest version of java which should work.
I have also used setantenv.bat in the right path.
here is the stack trace :
Apache Ant(TM) version 1.9.1 compiled on May 15 2013
C:\work\trail\hybris\bin\platform>**ant clean**
Java HotSpot(TM) Client VM warning: ignoring option MaxPermSize=128M; support
s removed in 8.0
Buildfile: C:\work\trail\hybris\bin\platform\build.xml
[echo] C:\work\trail\hybris\bin\platform/tomcat/bin
**BUILD FAILED**
C:\work\trail\hybris\bin\platform\build.xml:20: The following error occurred w
le executing this line:
C:\work\trail\hybris\bin\platform\resources\ant\antmacros.xml:73: The followin
error occurred while executing this line:
C:\work\trail\hybris\bin\platform\resources\ant\util.xml:234: -
**** **WRONG JAVA VERSION** ****
Environment check failed: You are using a not supported version of Java.
Please make sure you are using Java version 1.7 or later.
Your current Java version is: 1.8.0_40
TIP: If you are using eclipse you can configure a different JVM under
Preferences->Java->Installed JREs.
Total time: 1 second
Since you were able to get Hybris working with JDK 7, it appears that Java JDK version 1.8.0_40 does not have backwards compatibility/support for Hybris 5.2.0.6. You may want to open a bug with Hybris if you are feeling entrepid.
In eclipse go to platform - build.xml - right click on it - go to run as - external tools configuration - go to jre tab - add in separate jre the required jre version - add the build.xml file again to ant and run it
check this one
try this instead, adding java version in util.xml under platfrom folder. worked for me!

Using Java 1.7 without maven-compiler-plugin

Is there any way I can force maven to compile using java 1.7 standard without using the maven-compiler-plugin? I have read about the JAVA_HOME being not set properly, but I don't think this is the case.
I have added the following line in the mvn script:
echo $JAVA_HOME
Below is the output of mvn --version
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.11.0-12-generic", arch: "i386", family: "unix"
One problem would be that $JAVA_HOME is set to /usr/lib/jvn/java-7-oracle while manven reports it to be $JAVA_HOME/jre.
The question is is there a way to configure maven tu use java 1.7 (similar to javac -target 1.7) ?
The question is is there a way to configure maven tu use java 1.7
(similar to javac -target 1.7) ?
There is a way, and that is by configuring maven-compiler-plugin. That is what Maven uses for compiling, so that's what you need to configure.
If you insist on using javac, see what maven compiler plugin manual says:
Since 3.0, the default compiler is javax.tools.JavaCompiler (if you
are using java 1.6) and is used to compile Java sources. If you want
to force the plugin using javac, you must configure the plugin option
forceJavacCompilerUse.
but even in that case it would be also about configuring the maven-compiler-plugin.
You may configure the compiler plugin by passing appropriate -D... arguments when invoking maven. In your case this might be
mvn -Dmaven.compiler.target=1.7 compile
But i'd consider this an antipattern, as this makes your build dependent on additional parameters which must be documented. It is way better to define a proper configuration in some parent pom.
See compiler:compile for complete description of the maven-compiler-plugin
Based on http://maven.apache.org/plugins/maven-compiler-plugin/testCompile-mojo.html, it looks like you can set these properties can be set without "poluting" your pom.xml file by setting in the command line the properties maven.compiler.target and maven.compiler.source.
So, a command like below should solve your problem.
mvn install -Dmaven.compiler.target=1.7 -Dmaven.compiler.source=1.7
The default version for these atributes is 1.5.
You can also modify the mvn script and add in the exec line these two atributes.

Categories

Resources