Netty compile error - maven

I can't compile netty anymore. mvn compile gives the following:
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # netty-common ---
[INFO] Compiling 60 source files to /home/dennis/git/netty4/common/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Unable to locate the Javac Compiler in:
/opt/java/jre1.6.0_30/../lib/tools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
In most cases you can change the location of your Java
installation by setting the JAVA_HOME environment variable.
[INFO] 1 error
My configuration:
export JAVA_HOME=/opt/java/jre1.6.0_30
export M2_HOME=/opt/apache-maven-3.0.3
export M2=$M2_HOME/bin
export PATH=$JAVA_HOME/bin:$PATH
export PATH=$M2:$PATH
A part of my path:
$echo $PATH
/opt/java/jre1.6.0_30/bin:/opt/apache-maven-3.0.3/bin:/opt/git/bin:[...]
Maven status:
dennis#denpc:~/git/netty4$ mvn --version
Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
Maven home: /opt/apache-maven-3.0.3
Java version: 1.6.0_30, vendor: Sun Microsystems Inc.
Java home: /opt/java/jre1.6.0_30
Default locale: de_DE, platform encoding: UTF-8
OS name: "linux", version: "2.6.24-30-generic", arch: "i386", family: "unix"
Any ideas?

Please ensure you are using JDK 1.4 or above and
not a JRE [...]
It might have to do with this line in the error given in your post above. I believe you might want to make sure that you have the path to your JDK set, as well. Otherwise, it's just finding the JRE (jre1.6.0_30).
Note: The JDK might be found in your Java SDK folder.

Related

Using Jenkins and Maven, getting - 'mvn' is not recognized as an internal or external command, operable program or batch file

In the Build section, for Execute Windows batch command, I have the following:
mvn package
Here is the info from Console Output in Jenkins:
C:\Users\username\AppData\Local\Jenkins\.jenkins\workspace\Mvn_Web_App>mvn package
'mvn' is not recognized as an internal or external command,
operable program or batch file.
My setup is as follows:
Win10 Pro
apache-maven-3.6.3
apache-tomcat-8.5.64
Jenkins 2.277.1 LTS for Windows
Results for cmd test:
C:\Users\username>mvn --version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\apache-maven-3.6.3\bin\..
Java version: 1.8.0_281, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_281\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Installed, configured and input all the settings per seen in other posts.
I even set JDK and Maven under Global Tool Configuration
JDK
Name: jdk8
JAVA_HOME: C:\Program Files\Java\jdk1.8.0_281
Maven
Name: Maven 3.6.3
MAVEN_HOME: C:\apache-maven-3.6.3\
System Variables:
JAVA_HOME = C:\Program Files\Java\jdk1.8.0_281
M2_HOME = C:\apache-maven-3.6.3
Path = C:\Program Files\Java\jdk1.8.0_281\bin ; %M2_HOME%\bin
Instead of entering:
mvn package
I entered
C:\apache-maven-3.6.3\bin\mvn package
And then...IT WORKS!!! Why is that? Where is the disconnect... I cannot find it!
C:\Users\username\AppData\Local\Jenkins\.jenkins\workspace\Mvn_Web_App>C:\apache-maven-3.6.3\bin\mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< jenkins.mvn.demo:mvnwebapp >---------------------
[INFO] Building mvnwebapp Maven Webapp 0.0.1-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------

running maven scanner throws a JAXBException

With SonarQube 6.5, jdk 1.8.0_144 and sonar.maven.plugin 3.3.0.603, running mvn sonar:sonar gives me the following error:
Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project tdd: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar failed: A required class was missing while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar: javax/xml/bind/JAXBException
What am i missing?
Thanks,
Nilesh
I encountered this issue today as well. I recently installed JDK 9.0.1 and had switched the language level of my project over to source and target version 1.9. Executing a clean install triggered this exception. The issue was fixed and released recently in issue 2506 of their JIRA, so updating the sonarjava plugin from the sonarqube instance's administation panel fixed the issue for me.
Run into the same exact problem while running sonar analysis with java-9.
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T15:39:06-04:00)
Maven home: D:\java\maven\3.5.0\bin\..
Java version: 9, vendor: Oracle Corporation
Java home: D:\java\jdk\1.9.0_181
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
...
[INFO] --- sonar-maven-plugin:3.3.0.603:sonar (default-cli) # _test ---
...
[INFO] SonarQube version: 6.5.0
...
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project
maven:sonar-maven-plugin:3.3.0.603:sonar: javax/xml/bind/JAXBException
Same build still works fine with java-8.
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T15:39:06-04:00)
Maven home: D:\java\maven\3.5.0\bin\..
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: D:\java\jdk\1.8.0_131\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
...
[INFO] --- sonar-maven-plugin:3.3.0.603:sonar (default-cli) # _test ---
...
[INFO] SonarQube version: 6.5.0
...
[INFO] BUILD SUCCESS
I see same behavior with javax.javaee-api 6.0 7.0 or 8.0 thus problem seems to be not related to project dependencies.
Older org.sonarsource.scanner.maven.sonar-maven-plugin 3.2 version of plugin produces same result thus problem is not related to newer 3.3.0.603 plugin version.
Run only with maven 3.5.0.
Just for sake of it successfully tested with 1.8.0_144 in addition to 1.8.0_131.
Exact version of SonarQube is 6.5.0.27846.
Just a suggestion: make sure you are actually running java-8.
mvn -v

Maven Build failure in Jenkins

While running a build in Jenkins Maven is complaining about JDK. I know very well that it's some challenge with env variables. I have set JAVA_HOME to JDK installation path but no luck. I have searched the whole web and know that other people have faced this but their solution isn't working for me. Any help would be really appreciated !
[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
FYR, my maven version output.
root#zarvis:~# mvn -version
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T17:27:37+05:30)
Maven home: /usr/local/apache-maven-3.3.3
Java version: 1.7.0_101, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "3.19.0-31-generic", arch: "amd64", family: "unix"
JAVA_HOME is set but not sure why maven appends it with JRE.
root#zarvis:~# echo $JAVA_HOME
/usr/lib/jvm/java-1.7.0-openjdk-amd64
Thanks in advance !
Try adding JDK_HOME to your path

Build HikariCP from source

I want to replace BoneCP with HikariPC. Downloaded tar.gz from here and extracted. I don't know if this is a right command but inside hikaricp-java6 directory I run
$ mvn clean compile assembly:single
maven prints error
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/gkiko/Downloads/brettwooldridge-HikariCP-5cb1000/hikaricp-java6/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java:[358,20] cannot find symbol
symbol : method hasQueuedPredecessors()
location: class com.zaxxer.hikari.util.ConcurrentBag.Synchronizer
[ERROR] /Users/gkiko/Downloads/brettwooldridge-HikariCP-5cb1000/hikaricp-java6/src/main/java/com/zaxxer/hikari/pool/HikariPool.java:[150,37] cannot find symbol
symbol : method setRemoveOnCancelPolicy(boolean)
location: class java.util.concurrent.ScheduledThreadPoolExecutor
[ERROR] /Users/gkiko/Downloads/brettwooldridge-HikariCP-5cb1000/hikaricp-java6/src/main/java/com/zaxxer/hikari/pool/HikariPool.java:[486,28] cannot find symbol
symbol : method abort(java.util.concurrent.ExecutorService)
location: interface com.zaxxer.hikari.proxy.IHikariConnectionProxy
[INFO] 3 errors
[INFO] ------------------------------------------
[INFO] -------------------------------------------------------
[INFO] BUILD FAILURE
maven version:
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T21:37:52+04:00)
Maven home: /usr/local/Cellar/maven/3.2.1/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.4", arch: "x86_64", family: "mac"
java version:
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
Could you please tell me how to get jar file of HikariCP so I can add it to my java web app and use it with sqlite?
Java 8 is required to build HikariCP -- even the Java 6/7 compatible version. But you can download the JAR from the maven central repository here:
http://search.maven.org/#search%7Cga%7C1%7Chikaricp
Click on the 'jar' link for the HikariCP-java6 version 2.0.1 entry (second line).

Maven cannot find tools.jar w/ proper JAVA_HOME

I am having some trouble building a Maven project on my Windows machine. I have set my JAVA_HOME environment variable and Maven finds it.
Here are come results from a few executions:
'which mvn'
/cygdrive/c/Program Files/Apache/apache-maven-3.0.5/bin/mvn
'mvn -version'
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 05:51:28 0800)
Maven home: C:\Program Files\Apache\apache-maven-3.0.5
Java version: 1.6.0_45, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_45\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 8", version: "6.2", arch: "amd64", family: "windows"
Note: It does find the proper JAVA_HOME path here!
Building w/ Maven:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.
0.2:compile (default-compile) on project sportbukkit-api: Compilation failure
[ERROR] Unable to locate the Javac Compiler in:
[ERROR] C:\Program Files\Java\jre6\..\lib\tools.jar
[ERROR] Please ensure you are using JDK 1.4 or above and
[ERROR] not a JRE (the com.sun.tools.javac.Main class is required).
[ERROR] In most cases you can change the location of your Java
[ERROR] installation by setting the JAVA_HOME environment variable.
As you can see, for some reason it is looking in the completely wrong directory. Please let me know if any more info is needed or if you know how to fix this! Thank you!
Try setting your JAVA_HOME to C:\Program Files\Java\jdk1.6.0_45 instead of C:\Program Files\Java\jdk1.6.0_45\jre

Resources