I'm trying to compile the oVirt open source project on fedora core 21,
java -version
openjdk version "1.8.0_20"
OpenJDK Runtime Environment (build 1.8.0_20-b26)
OpenJDK 64-Bit Server VM (build 25.20-b23, mixed mode)
I am getting the following errors:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project builtin: Compilation failure: Compilation failure:
[ERROR] /home/jenkins/workspace/ovirt-engine_master_find-bugs_merged_nomvn/ovirt-engine/backend/manager/modules/builtin-extensions/src/main/java/org/ovirt/engine/extensions/aaa/builtin/kerberosldap/utils/ipa/SimpleAuthenticationCheck.java:[61,25] error: cannot access InitializingBean
[ERROR] /home/jenkins/workspace/ovirt-engine_master_find-bugs_merged_nomvn/ovirt-engine/backend/manager/modules/builtin-extensions/src/main/java/org/ovirt/engine/extensions/aaa/builtin/kerberosldap/LDAPTemplateWrapper.java:[145,31] error: cannot access DisposableBean
mvn -version shows :
mvn -version
Apache Maven 3.2.2 (NON-CANONICAL_2014-06-19T11:19:24_mockbuild; 2014-06-19T11:19:24+00:00)
On fedora core18 it works -
Apache Maven 3.0.4 (rNON-CANONICAL_2013-04-08_07-49_mockbuild; 2013-04-08 10:49:23+0300)
Maven home: /usr/share/maven
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.9.11-200.fc18.x86_64", arch: "amd64", family: "unix"
The spring that is being used is aligned to 3.1.1.RELEASE from what I can see
In both the machines.
Can you give a hand? I know I'm using code that implements InitialzingBean and DisposableBean, but still - if same spring version, how come it does not compile
we had this problem and we had installed JDK 1.8. When we installed JDK 1.7 then this issue disappeared. Try it, maybe it is your case :)
Related
I have a maven project which needs
import com.sun.tools.classfile.Dependencies;
I can build it successfully in IntelliJ. But when I build it outside using "mvn clean install". I got the error "Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ... package com.sun.tools.classfile does not exist".
Package com.sun.tools.classfile belongs to $JAVA_HOME/lib/tools.jar. and it exists under that directory. Seems that Intellij can find it but maven build could not find it. Anyone knows why it could happen?
My machine is Macbook pro. Here are the java version and maven verion on my box.
echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode)
mvn -version
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: /Users/wuming/apache-maven-3.8.1
Java version: 1.8.0_292, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.7", arch: "x86_64", family: "mac"
Thanks
If you added maven via brew install maven you will get this type of issue.
Better to get the apache maven and setup the path variables accordingly.
To setup the path variables check this
I believe this is an issue with my development environment since I was able to build this jar before I needed switch to a new laptop.
I need to build this jar with java version 1.7 due to production environment requirements.
In the pom.xml I have the properties
<properties>
<checkstyle.version>8.10.1</checkstyle.version>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
bash-3.2$ java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
bash-3.2$ mvn --version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
Java version: 1.7.0_80, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.7", arch: "x86_64", family: "mac"
When I run:
mvn package -DbuildNum=1.0.0-SNAPSHOT
It fails with the output:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.0.0:check (compile) on project syn-dap-hadoop: Execution compile of goal org.apache.maven.plugins:maven-checkstyle-plugin:3.0.0:check failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-checkstyle-plugin:3.0.0:check: java.lang.UnsupportedClassVersionError: com/puppycrawl/tools/checkstyle/api/CheckstyleException : Unsupported major.minor version 52.0
Changing my JAVA_HOME to java 1.8 allows it to build properly, but I need it to be built in 1.7 for the environment it runs in.
Usually, it is no problem to build with JDK 1.8 for Java 1.7. The resulting artifacts will run on a Java 1.7 environment just fine.
If you don't want this, you need to downgrade your checkstyle plugin to a version that still support Java 1.7.
I am trying to package a java project using maven. I've done it before on my old computer, but I can't seem to make it work on my new computer.
Here is the error:
`
(env)kyle#thinkpad ~/Code/simplefilehosting $ mvn -version
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.7.0_95, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-38-generic", arch: "amd64", family: "unix"
(env)kyle#thinkpad ~/Code/simplefilehosting $ java -version
java version "1.7.0_95"
OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
(env)kyle#thinkpad ~/Code/simplefilehosting $ javac -version
javac 1.7.0_95
(env)kyle#thinkpad ~/Code/simplefilehosting $
Here is my version information for java, javac and mvn:
(env)kyle#thinkpad ~/Code/simplefilehosting $ mvn -version
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.7.0_95, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-38-generic", arch: "amd64", family: "unix"
(env)kyle#thinkpad ~/Code/simplefilehosting $ java -version
java version "1.7.0_95"
OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
(env)kyle#thinkpad ~/Code/simplefilehosting $ javac -version
javac 1.7.0_95
(env)kyle#thinkpad ~/Code/simplefilehosting $
I tried looking at it online and add a plugin but then my mvn never realized the plugins tag or anything else. And I haven't changed the pom.xml from the last time I was able to package it.
Without the actual error message to diagnose (I think you intended to include it but didn't)...but a few things:
-check your M2_HOME and JAVA_HOME variables and make sure they are correct
-make sure settings.xml is in your ~/.m2 or $M2_HOME/config directories
-on your old machine, delete your entire ~/.m2/repository directory and see if it builds, if you upgraded Maven along the way there might be something you already have that Maven3 can't for some reason download
-consider upgrading, 3.0.5 was an intermediate version that was between the old Maven2 and Maven3 artifact resolution, some major differences, some completely different behavior, who knows what you have.
I have this compilation error un maven
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on
a JRE rather than a JDK?
[INFO] 1 error
But It's not possible because I have the jdk in my path: ;..;C:\PROGRA~2\Java\jdk1.7.0_71\bin
and:
C:\Development\Workspaces\EclipseWS\devices-project>java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) Client VM (build 24.71-b01, mixed mode, sharing)
and here mvn -v :
C:\Users\joanet>mvn -v
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:
28+0100)
Maven home: C:\apache-maven-3.0.5\bin\..
Java version: 1.7.0_71, vendor: Oracle Corporation
Java home: C:\PROGRA~2\Java\jdk1.7.0_71\jre
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
If you run mvn -v you will see what Maven thinks it is using
e.g.
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-15T03:59:23+10:30)
Maven home: /usr/local/Cellar/maven/3.2.5/libexec
Java version: 1.6.0_65, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.9.5", arch: "x86_64", family: "mac"
Is your problem one of these StackOverflow errors?
Eclipse/Maven error: "No compiler is provided in this environment"
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
Maven error :Perhaps you are running on a JRE rather than a JDK?
Maven Package Compilation Error
Or any of the other google answers.
I'm getting a compilation error when I compile using maven but works in eclipse. Both are using the same JDK:
java -version
java version "1.6.0_35"
Java(TM) SE Runtime Environment (build 1.6.0_35-b10)
Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01, mixed mode)
mvn -version
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.6.0_35, vendor: Sun Microsystems Inc.
Java home: /usr/lib/jvm/jdk1.6.0_35/jre
Default locale: es_ES, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-29-generic", arch: "amd64", family: "unix"
This is the error:
[ERROR] /blablabla.../myClass.java: [78,107] inconvertible types
[ERROR] found : java.util.Collection<java.lang.Object>
[ERROR] required: java.util.Collection<? extends org.springframework.integration.store.MessageGroup>
[ERROR] -> [Help 1]
And this is the code (no compilation error in eclipse):
Collection<? extends MessageGroup> collection = (Collection<? extends MessageGroup>) this.groupMap.values();
I know that this is a pretty recursive issue, I've found a few posts asking the same, but seems that nobody has a standar fix. Some people say that works with different JDK version. I have tested with 1.6.0_30, 1.6.0_31, 1.6.0_32 and 1.6.0_35 and all fail.
Any idea?
Thanks
I suspect eclipse isn't using the JDK you think it is. Try using type erasure.
Collection<? extends MessageGroup> collection =
(Collection<? extends MessageGroup>)
(Collection) this.groupMap.values();