I'm trying to use the scala-maven-plugin:3.1.0 with Java 1.5. However my maven build is failing with an incompatibility error.
Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.1.0:compile (scala-compile-first) on project proj: Execution scala-compile-first of goal net.alchim31.maven:scala-maven-plugin:3.1.0:compile failed: Unable to load the mojo 'compile' in the plugin 'net.alchim31.maven:scala-maven-plugin:3.1.0' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: Bad version number in .class file
There is also an unsupported class version warning
WARNING: Error injecting: scala_maven.ScalaCompileMojo
java.lang.UnsupportedClassVersionError: Bad version number in .class file
The documentation for the plugin says that it requires Java 1.5 so i dont see a problem there. I'm using Java 1.5 locally and also for my maven build.
Any suggestions to where the problem is? I cant see where another version of Java could be used to compile any of my classes so I'm guessing its an incompatibility in one of the dependencies i have but I've had no luck finding it. I'm also importing the following dependency
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.9.0-1</artifactId>
<version>2.0.M5</version>
</dependency>
Answer as posted by #om-nom-nom
As far as I know, scala version scalatest was compiled against (2.9.x) require at least 1.6 version of Java platform.
Related
I try to generate the Java API documentation of a project composed of multiple sub-modules with mvn site but it doesn't work whereas mvn install works, it resolves all dependencies and it compiles successfully. mvn site resolves neither the dependencies that are inherited by all sub-modules in the parent pom file (including easymock) nor the dependencies specific to some sub-modules (including SWT).
I obtain the following error message:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.7.1:site (default-site) on project ardor3d: Error generating maven-javadoc-plugin:3.1.1:aggregate report:
[ERROR] Exit code: 1 - /home/gouessej/Documents/programming/java/workspace/Ardor3D/ardor3d-swt/src/test/java/com/ardor3d/input/swt/TestSwtMouseWrapper.java:23: error: package org.eclipse.swt.events does not exist
I use Maven 3.6.1 with OpenJDK 11. This problem concerns the open source project JogAmp's Ardor3D Continuation and is reproducible with the latest source code.
I saw a similar question here but I don't think that the accepted answer helps in my case.
It worked with Java 8 but I'm not sure that it's the culprit.
P.S: Reverting this change and using Java 8 work around this bug.
Replacing <release>8</release> by <source>1.8</source><target>1.8</target> and using Java 8 instead of Java 11 solve the problem. It's probably a bug of maven-javadoc-plugin with Java 11. This bug has been reported here.
I am trying to install a web-app using maven. I see this error that reads:
Failed to execute goal
org.apache.cxf:cxf-codegen-plugin:3.0.13:wsdl2java (generate-sources)
on project -simple-webapp: Execution generate-sources of goal
org.apache.cxf:cxf-codegen-plugin:3.0.13:wsdl2java failed:
java.lang.IllegalStateException: You are running with invalid JAXP api
or implementation. JAXP api/implementation of version 1.3.1 (included
in JDK6) or higher is required. In case you are using ant, make sure
ant 1.7.0 or higher is used - older versions of ant contain JAXP
api/impl version 1.2 (in xml-apis.jar). If you want to keep using
older ant versions, you have to configure it to use higher the JAXP
api/impl versions.
javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
-> [Help 1]
The weird part is that I have specified the dependency on jaxp in my pom.xml:
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jaxp-api</artifactId>
<version>1.4</version>
</dependency>
And this is correctly downloaded. I can see that in my .m2 repository. But some how it can still not find.
Any suggestions on how to fix this issue?
I solved this issue by using the following code. I am using JDK8 in my project
System.setProperty("javax.xml.transform.TransformerFactory", "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
When I try to build my java project using Java 1.8 and Gradle 1.7 I am getting the following error:
Execution failed for task ':compileGroovy'.
> BUG! exception in phase 'semantic analysis' in source unit 'C:\...\groovy\org\gradle\plugins\svnkit\GroovySvnKitPluginConve
ntion.groovy'
Could not load class 'org.gradle.plugins.svnkit.svnclient.WorkingC
opy' from file:/C:/.../gradle/p
lugins/svnkit/svnclient/WorkingCopy.class.
My project builds in Java 7, what could be the issue now with Java 8?
What version of Groovy are you compiling with (in your dependencies)?
Groovy doesn't support Java 8 until 2.3.
If that doesn't fix it, and it is a more internal Gradle issue (it's hard to tell as you don't post and example build script, or the full exception), you might need to upgrade to Gradle 2+ as that is when they migrated to the Java 8 supporting versions of Groovy.
I am trying to write Kafka producer and consumer code in Java using Eclipse.
I am have downloaded the Kafka jar file and loaded as external Jar file. And it solved the dependency problem.
However, there is always a unresolved error and the message looks like below:
Multiple markers at this line
- The type scala.Product cannot be resolved. It is indirectly referenced from required .class files
- The type scala.Serializable cannot be resolved. It is indirectly referenced from required .class
files
I really don't know what is going on and how to fix that error. Thanks.
UPDATED 4/26/2018
It appears that you need to have the Scala runtime library in your Eclipse project's classpath.
If you're using Maven (or some other repository-based build tool—highly recommended), then adding Kafka as a dependency should cause it to automatically download the corresponding Scala runtime library and include it on your project's classpath. For example,
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.12</artifactId>
<version>1.1.0</version>
</dependency>
will cause Maven to download version 2.12.4 of the Scala runtime library.
Otherwise, you can install Scala (see http://scala-lang.org/) and add the installed scala-library.jar to your project's classpath manually. However, you should note that Scala minor releases (2.10.x, 2.11.x, 2.12.x, etc.) are not binary compatible with each other, so you should download the most recent bug-fix version of the minor release used to build your version of Kafka. (This minor version is appended to the name of the Kafka artifact, e.g. kafka_2.12 requires a Scala 2.12.x runtime library version.)
Downloaded the scala libraries from http://scala-lang.org/download/ and added the scala-library.jar to the project, error resolved!
Delete the unneccessary jar files and keep exact version jar file. It worked for me.
Note this is for the SpringSource plugin.
When I try to import a Gradle project in Eclipse I am getting the following error:
Project location doesn't exist; See error log for details.
The stacktrace error is basically this:
Caused by: java.lang.IllegalArgumentException: Project location doesn't exist
I did some research, and a Gradle defect (https://issuetracker.springsource.com/browse/STS-3158) mentions that error handling was improved with a more useful error message, including the project location.
I have Gradle 1.7 now on my machine; however Eclipse/Springsource keeps using Gradle 1.2. How do I get it to use 1.7 (or even 1.8)
I recommend to check "Preferences->Gradle->Use Gradle wrapper's default" and install the Gradle Wrapper for all builds in question. Then Eclipse will automatically pick the right Gradle version for each build (and nobody has to install Gradle manually).