I'm in to process of upgrading from 1.6 to 1.8.
Because of this, I'm looking for a good way to list all dependencies that aren't Java 1.8 compatible. I've got JAVA_HOME is already set. and I'm using Maven 3.3.9.
I'm looking for something like:
mvn dependancy:compatabilityTest
Environment Info:
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T11:41:47-05:00)
Maven home: C:\Data\apps\apache-maven-3.3.9\bin\..
Java version: 1.8.0_112, vendor: Oracle Corporation
Java home: C:\Program Files (x86)\Java\jdk1.8.0_112\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "dos"
"Failed to transform class with name" most likely means byte code generation or transformation is being used. There is no way to determine this statically as the class doesn't exist in the form it will be loaded until the program is run.
Java 8 adds some validation to the byte code which wasn't in older versions. This means byte code generated in Java 5.0 which wasn't valid might not have failed but now it does. The solution is to upgrade the version of the byte code generator and most likely the library which uses it.
Related
I download a new maven and execute using the full path, but still get the old version, and it doesn't help even I put it on PATH. It's very weird.
I run the maven as version of 3.3.9, but it still use the 3.2.5
-bash-4.1# /usr/hdp/2.3.2.0-2950/apache-maven-3.3.9/bin/mvn --version
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
Maven home: /usr/share/apache-maven
Java version: 1.7.0_91, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.91.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-573.7.1.el6.x86_64", arch: "amd64", family: "unix"
M2_HOME is set as the old maven home directory. Seems maven will pick up the MAVEN from this environment variable.
I'm trying to build something with maven, but keep getting the following error in intellij
-Dmaven.multiModuleProjectDirectory system property is not set. Check $M2_HOME environment variable and mvn script match.
So after searching the internet I found some ideas with the environment variables. But I checked with mvn -version and this is the response I get:
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: /usr/local/Cellar/maven/3.3.9/libexec
Java version: 1.8.0_65, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre
Default locale: nl_NL, platform encoding: UTF-8
OS name: "mac os x", version: "10.11", arch: "x86_64", family: "mac"
So I don't really know what I need to do extra to get this started?
If you are using IntelliJ, try to look at this post
You need to set the argument -Dmaven.multiModuleProjectDirectory=$M2_HOME to your JRE
I want to install the Chef maven cookbook from the community site, and select java version 7. To do so I have added the following attributes in the attributes/default.rb of my recipe.
# Configure java and maven
default['maven']['setup_bin'] = true
node.override[:java][:jdk_version] = '7'
node.override[:java][:openjdk_packages] = [
"openjdk-7-jdk", "openjdk-7-jre-headless"
]
This does not work, as it installs java version 6. I have tried other variants with the same result, such as:
# Configure java and maven
default['maven']['setup_bin'] = true
default['java']['jdk_version'] = '7'
My platform is an Ubuntu precise64.
The output of mvn -v is the following:
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09 17 15:22:22+0000)
Maven home: /usr/local/maven
Java version: 1.6.0_34, vendor: Sun Microsystems Inc.
Java home: /usr/lib/jvm/java-6-openjdk-amd64/jre
Default locale: en_US, platform encoding: ISO-8859-1
OS name: "linux", version: "3.2.0-23-generic", arch: "amd64", family: "unix"
How can I tell the java cookbook to install version 7?
Thanks!
Daniel
Your code is not working because you have not set the node['java']['openjdk_version'] attribute. Here is the relevant code segment:
node['java']['openjdk_packages'].each do |pkg|
package pkg do
version node['java']['openjdk_version'] if node['java']['openjdk_version']
end
end
Another option would be not to set the node['java']['openjdk_packages'] attribute. The set_attributes_from_version recipe contains logic to do this based on the OS.
SOLVED I solved the error by downgrading Maven to 3.0.5.
Original post:
I am quite new to Maven and want to use it with Android.
I try to go this tutorial, but I am stuck at step 4, I get this error.
Running mvn -version returns
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 18:22:22+0300)
Maven home: /opt/apache-maven-3.1.1
Java version: 1.7.0_21, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.9", arch: "x86_64", family: "mac"
There are quite few posts about it, and JIRA ticket for it, but I don't know how to fix as fast as possible.
I have just got a Mac BookPro with os OS X Lion which has maven pre installed with the version
#mvn --version
Apache Maven 3.0.3 (r1075438; 2011-02-28 19:31:09+0200)
Maven home: /usr/share/maven
Java version: 1.6.0_31, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: tr_TR, platform encoding: MacTurkish
OS name: "mac os x", version: "10.7.4", arch: "x86_64", family: "mac"
When I run a
mvn clean install
maven is somehow failing compiling. One of the fail reason is : java.lang can not found.
When I check java settings I saw that there is both 64 and 32 bit java versions.
thanks.
In the Java properties :
There are two Java instances
Java SE Apple Inc. 64 Bits 1.6.0_31-b04-415
Java SE Apple Inc. 64 Bits 1.6.0_31-b04-415
First try to write HelloWord.java and compile it using command line javac HelloWord.java.
If it works move towards maven. Check environment variable JAVA_HOME that is used by maven to find java. I believe it points to "wrong" java version. Fix this and try again. I hope this will work.