Build maven project with broken classes of Oracle-JDK8 - java

When I use GraphChi-java benchmark to analysis network graph, I encounter an issue related to mvn.
Maven version and Java Version:
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T03:58:13-04:00)
Maven home: /usr/local/maven
Java version: 1.8.0_161, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-041500-lowlatency", arch: "amd64", family: "unix"
The build information is link
mvn assembly:assembly -DdescriptorId=jar-with-dependencies
However, I get errors about
error: error while loading CharSequence, class file '/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar(java/lang/CharSequence.class)' is broken
error: error while loading ConcurrentMap, class file '/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar(java/util/concurrent/ConcurrentMap.class)' is broken
error: error while loading AnnotatedElement, class file '/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar(java/lang/reflect/AnnotatedElement.class)' is broken
These errors are weird since I think there should be no problem with java-8-oracle. Why are some class broken? How to fix it?
wxf#wxf:/home/wxf/javaPrj/graphChi/graphchi-java$ mvn assembly:assembly -DdescriptorId=jar-with-dependencies
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.graphchi:graphchi-java_2.11:jar:0.2.2
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.apache.commons:commons-math:jar -> version 2.0 vs 2.1 # line 81, column 17
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building graphchi-java_2.11 0.2.2
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-assembly-plugin:2.2.2:assembly (default-cli) > package # graphchi-java_2.11 >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # graphchi-java_2.11 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/wxf/javaPrj/graphChi/graphchi-java/src/main/resources
[INFO]
[INFO] --- maven-scala-plugin:2.15.2:compile (default) # graphchi-java_2.11 ---
[INFO] Checking for multiple versions of scala
[INFO] includes = [**/*.java,**/*.scala,]
[INFO] excludes = []
[INFO] /home/wxf/javaPrj/graphChi/graphchi-java/src/main/java:-1: info: compiling
[INFO] /home/wxf/javaPrj/graphChi/graphchi-java/src/main/scala:-1: info: compiling
[INFO] Compiling 121 source files to /home/wxf/javaPrj/graphChi/graphchi-java/target/classes at 1518718593215
[ERROR] error: error while loading CharSequence, class file '/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar(java/lang/CharSequence.class)' is broken
[INFO] (bad constant pool tag 18 at byte 10)
[ERROR] error: error while loading ConcurrentMap, class file '/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar(java/util/concurrent/ConcurrentMap.class)' is broken
[INFO] (bad constant pool tag 18 at byte 61)
[ERROR] error: error while loading AnnotatedElement, class file '/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar(java/lang/reflect/AnnotatedElement.class)' is broken
[INFO] (bad constant pool tag 18 at byte 76)
[ERROR] three errors found
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.874 s
[INFO] Finished at: 2018-02-15T13:16:38-05:00
[INFO] Final Memory: 26M/1928M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.scala-tools:maven-scala-plugin:2.15.2:compile (default) on project graphchi-java_2.11: wrap: org.apache.commons.exec.ExecuteException: Process exited with an error: 1(Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Related

Why jdk works well but get mvn compile error

My jdk works well, but I get the error when running mvn compile
PS H:\Learning\Maven> java -version
java version "1.8.0_281"
Java(TM) SE Runtime Environment (build 1.8.0_281-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.281-b09, mixed mode)
PS H:\Learning\Maven> mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< com.xxx:maven01 >---------------------------
[INFO] Building maven01 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # maven01 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # maven01 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to H:\Learning\Maven\target\classes
[INFO] -------------------------------------------------------------
[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
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.566 s
[INFO] Finished at: 2021-07-23T23:18:05+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project maven01: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
javac runs fine. After I changed jre to jdk for JAVA_HOME, I didn't reopen powershell and it kept giving me errors.

ERROR Failed to execute goal io.quarkus:quarkus-maven-plugin:1.13.2.Final:dev (default-cli) on project code-with-quarkus:

when I use the command mvn clean quarkus: dev, I get the following response from the terminal in intellij:
E:\api-hard-lot>mvn clean quarkus:dev
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< org.acme:code-with-quarkus >---------------------
[INFO] Building code-with-quarkus 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # code-with-quarkus ---
[INFO] Deleting E:\api-hard-lot\target
[INFO]
[INFO] --- quarkus-maven-plugin:1.13.2.Final:dev (default-cli) # code-with-quarkus ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 31 source files to E:\api-hard-lot\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.052 s
[INFO] Finished at: 2021-04-25T12:02:55-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.13.2.Final:dev (default-cli) on project code-with-quarkus: Fatal error
compiling: invalid target release: 11 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
'cmd' is not recognized as an internal command
or external, an operable program or a batch file.
Your project was created using JDK 11 and thus mandates JDK 11 while you are trying to build it with a JDK inferior to 11.
Either update your JDK (recommended) or adjust your project to be JDK 8 compatible (replace occurrences of 11 with 1.8 in your pom file).
thanks guys thats exactly my solution i alter to jdk 8 and
in pom
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
and
in code-with-quarkus

deploy using Jboss Tools plugin for OpenShift generates error invalid target release: 1.8

I'm using JBoss Tools plugin in my project to deploy the application to OpenShift. When command to deploy the build failure. Follow the log of the error below:
Stopping jbossews cartridge
Sending SIGTERM to jboss:354331 ...
Stopping MySQL 5.5 cartridge
Stopping PHPMyAdmin cartridge
Waiting for stop to finish
Waiting for stop to finish
Repairing links for 1 deployments
Building git ref 'master', commit 11577ee
Using Maven mirror /var/lib/openshift/56cb57232d5271befc00009a/app-root/runtime/repo//.openshift/config/settings.rhcloud.xml
Apache Maven 3.0.4 (r1232336; 2012-12-18 14:36:37-0500)
Maven home: /usr/share/java/apache-maven-3.0.4
Java version: 1.7.0_95, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.95/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "2.6.32-573.18.1.el6.x86_64", arch: "i386", family: "unix"
Found pom.xml... attempting to build with 'mvn --global-settings /var/lib/openshift/56cb57232d5271befc00009a/app-root/runtime/repo//.openshift/config/settings.rhcloud.xml clean package -Popenshift -DskipTests'
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Picos 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) # Picos ---
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # Picos ---
[debug] execute contextualize
[WARNING] Using platform encoding (ANSI_X3.4-1968 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # Picos ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding ANSI_X3.4-1968, i.e. build is platform dependent!
[INFO] Compiling 102 source files to /var/lib/openshift/56cb57232d5271befc00009a/app-root/runtime/repo/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.770s
[INFO] Finished at: Tue Feb 23 13:43:53 EST 2016
[INFO] Final Memory: 8M/114M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Picos: Fatal error compiling: invalid target release: 1.8 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
An error occurred executing 'gear postreceive' (exit code: 1)
Error message: CLIENT_ERROR: Failed to execute: 'control build' for /var/lib/openshift/56cb57232d5271befc00009a/jbossews
I'm locally using java tomcat 8 and 8 to run my project. I think it has to do with it. What should I do so that I can do to deploy OpenShift?
Could someone help me?
You need to use Java 7 and (probably) Tomcat 7 locally to develop your application so that it is compatible with OpenShift Online. If you want to keep using Java 8, you should try deploying to the WildFly or JBoss EAP cartridges.

Please verify you invoked Maven from the correct directory

I have installed maven :
C:\Windows\System32>mvn --version
Apache Maven 3.3.3 (7994120775791599e405a7528ec3e0dke21dja06; 2015-04-22T13:57:3
7+02:00)
Maven home: C:\Program Files\Apache Software Foundation\apache-maven-3.3.3
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_51\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 8", version: "6.2", arch: "amd64", family: "windows"
I am trying to generate Jersey glassfish project with the aid of maven prompt but when I type the following:
D:\maven>mvn archetype:generate -DarchetypeGroupId=org.glassfish.jersey.archety
pes -DinteractiveMode=false \ -DarchetypeVersion=2.17
I am getting this error:
The goal you specified requires a project to execute but there is no POM
in this directory (D:\maven). Please verify you invoked Maven from the correct
directory. -> [Help 1]
I dont understand the error: Which project is required here since I am trying to generate one? And how should I create the pom.xml file? I thought it is created by the project generation.
I appreciate any help.
Edit when I type it without \
D:\maven>mvn archetype:generate -DarchetypeGroupId=org.glassfish.jersey.archety
pes -DinteractiveMode=false -DarchetypeVersion=2.17
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.3:generate (default-cli) > generate-sources
# standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.3:generate (default-cli) < generate-sources
# standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.3:generate (default-cli) # standalone-pom --
-
[INFO] Generating project in Batch mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.glassfish.jer
sey.archetypes:maven-archetype-quickstart:2.17)
Downloading: https://repo.maven.apache.org/maven2/org/glassfish/jersey/archetype
s/maven-archetype-quickstart/2.17/maven-archetype-quickstart-2.17.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.542 s
[INFO] Finished at: 2015-05-12T16:39:51+02:00
[INFO] Final Memory: 17M/152M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2
.3:generate (default-cli) on project standalone-pom: The desired archetype does
not exist (org.glassfish.jersey.archetypes:maven-archetype-quickstart:2.17) -> [
Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption
D:\maven>
I'll go for an answer now.
So the first part of your problem was the caracter "\". See this thread
Then for your second problem : it is said The desired archetype does
not exist. This archetype maven-archetype-quickstart doesn't exist in maven repository. Please refer to this link to choose the archetype you are looking for and put it in your command.
At the end you command must have at least 2 argument -DarchetypeGroupId and -DarchetypeArtifactId. For example :
mvn archetype:generate -DarchetypeGroupId=org.glassfish.jersey.archetypes -DarchetypeArtifactId=jersey-quickstart-webapp

Console maven compile error

i was macking one of the oficial guides of spring: http://spring.io/guides/gs/maven/
But when y reach the part where i have to compile with maven this is what happens:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building gs-maven-initial 0.1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # gs-maven-i
nitial ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory c:\Java\WorkSpace\maven_beginer\src\m
ain\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) # gs-maven-init
ial ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. b
uild is platform dependent!
[INFO] Compiling 2 source files to c:\Java\WorkSpace\maven_beginer\target\classe
s
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.692s
[INFO] Finished at: Wed Nov 06 23:51:21 ART 2013
[INFO] Final Memory: 9M/102M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.
5.1:compile (default-compile) on project gs-maven-initial: Fatal error compiling
: tools.jar not found: C:\Java\jdk\..\lib\tools.jar -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
Goto Windows -> Preferences
Java -> Installed JREs
Change JRE to JDK
You can resolve this issue by
Add JAVA_HOME to System variable
or Copy you java folder to c:\ from c:\program files or c:\program files (x86)
or Missing tools.jar in local repository breaks m2eclipse

Categories

Resources