ecilpse/junit5:Test cannot be resolved to a type - java-9

My eclipse seems not to be able to resolve JUnit 5 types
when I write a test in a Java 9 module:
"Test cannot be resolved to a type"
I manually have added the JUnit 5 Library to the projects buildpath.
Also I did these "clean project" and "update eclipse from pom.xml"
kind of things.
When I build this project with the embedded Maven there is no problem,
the test is compiled and executed.
Is it an eclipse bug in conjunction with java 9 modules
or how do i have to configure eclipse correctly?
Configuration:
eclipse Oxygen.2
JDK 9.0.1

There are some issues related to Java9 and Junit5 here https://github.com/junit-team/junit5/issues/425
A way out of this is using the support for Oxygen:
https://marketplace.eclipse.org/content/junit-5-support-oxygen

Related

Deploy only a javadoc

My project uses asciidoclet to generate javadocs. Turns out that with Java 9 the Javadoc API has changed so much that the asciidoclet used by Maven's javadoc-plugin was never ported to Java 9+. So the only way to generate the Javadoc is by running it under Java 8.
I can exclude creating the Javadoc when deploying to maven central. But how can I just release the Javadoc to sonatype?
It is simple
mvn javadoc:jar deploy:deploy
My mistake was that I used javadoc:javadoc. Stupid me.
So compile and deploy under Java 9+ with -Dmaven.javadoc.skip=true and then run under java 8 again with javadoc and deploy. Works for now.

deployment error through maven using ----java jar <jarfile>.jar

I have created a Spring Starter data jpa project and its connecting with mysql. through STS its running fine.
i wanted to deploy it individually so i clean install the application using maven and used java jar <jarfile.jar> in command prompt.
I followed the video of java brains.
Below is the error which get
JAXB is not found.
It seems that you set the scope of the JAXB dependency to provided or built the project for an old Java Version (like Java 8) that comes with JAXB and run it with a newer Java version (like Java 10) that does not come with JAXB.
You can fix this by adding the JAXB dependency to the classpath when running the JAR or by adding the dependency to your project manually(or set the scope to compile)

How to use Junit 4 with Java 9 modules, Maven and Eclipse?

I created a simple Java 9 / Maven project with a Main class and a JUnit 4 test class using the default Maven directory layout.
I have a module-info.java file in the folder src/main/java, Java 9 is configured in the POM. Only Java 9 is used at all places.
The maven build succeeds, the test is executed.
When I import the project to Eclipse (Import existing Maven project, Oxygen.1a), Eclipse complains about JUnit not beeing in the classpath - but it appears in the Maven classpath. Eclipse suggests to add JUnit to the classpath - but that doesn't help either.
(Without module-info.java the Eclipse project works as expected).
Is this an Eclipse issue or should I do a different setup?
Is there an easy workaround?
As I understood, surefire takes some special measures to overcome the problem that test classes are located in a different directory than module-info.java.
How does Eclipse handle this?

Can sonar build java 6 and java 7 projects on a single server?

We have a server that runs Sonar and previously only had Java 6 installed and everything worked fine. We now have a Java 7 project and are encountering the "Unsupported major.minor version 51.0" version when the Maven surefire plugin tries to analyze the project.
Is there a way to specify the Java version sonar should use for a specific project?
Java 7 is already installed on the server.
Thanks in advance!
Never mind found the JDK option under Advanced in the Jenkins configuration for the job.

What should be in the build.gradle file to support imports of the standard groovy libraries

I had created a groovy project. It worked by itself.
After some additions I had to add a new jar of a new library into the imports.
While the whole workspace runs on Gradle, I added the appropriate Maven reference to the gradle.build file.
After running gradle cleanEclipse Eclipse the new library works OK.
But. All project references to the Groovy libraries disappeared. Foolish me, I had to put some references to them into the gradle.build, too.
The list of libraries:
groovy.util.slurpersupport
groovy.xml
org.codehaus.groovy.tools.xml
groovy.lang
But I don't know how to include them into gradle.build. I can't found them in maven repository. And even so, I have them installed in my Eclipse, and I should take these. And I can't google any help, because gradle groovy gives the results on how to call gradle from groovy, not vice versa.
Moving from plain Groovy to Gradle won't help, it is really about gradle support for calling a java library from groovy.
I have nothing against getting dependencies from Maven rep., but I don't know how to do it in my case - The problem is, that I have Eclipse 3.6. And I should use the last version of groovy for Eclipse 3.6. So, I have installed it from http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.6/. And I don't know what is the equivalent version in Maven - there is no info about it.
There was some error in the groovy in Eclipse installation. Now after running gradle cleanEclipse Eclipse while build.gradle has NO dependencies to groovy, almost everything runs OK, I only have to add the groovy nature to the project

Resources