Classes can't be found in Maven Dependencies - java

I suddenly encountered the following problem: it does not recognise certain class files from the dependencies.
Screenshot
Thinking it was because of my installation, I re-installed everything from Java to the Maven Plugin and tried to compile and run the SimpleExample from a clean project. Which gives the following result: Screenshot and the following exception: Screenshot

Your project is missing the dependency rinsim-core with groupId com.github.rinde.
Check with dependency:list if it is present. If not, add it.
If it is already there, try to compile the project outside eclipse. Install a command line maven, navigate to the directory, do mvn clean package and report any error you get as a comment under this answer.

Related

Eclipse not able to resolve Maven dependency

I have been working on a Java Maven project and my way of using it in Eclipse was to build it on command line and then import in Eclipse. The problem that I was facing is even though the project built successfully, eclipse was not able to resolve dependencies correctly.
This problem would usually go by cleaning, Maven updating and deleting and importing. However, this time it did not get resolved by following these steps. I tried a lot of already existing answers but nothing worked for me. However, I observed that the classpath is not getting created correctly:
I'm seeing that one of the dependency jars is marked as missing
I tried to create the Eclipse .classpath file using:
mvn eclipse:clean
mvn eclipse:eclipse
But mvn eclipse:eclipse fails with the following message:
Failed to execute goal on project consultation: Could not resolve
dependencies for project
company.compliance:consultation:jar:1.0-SNAPSHOT: Failure to find
company.compliance:commons:jar:1.0-SNAPSHOT in
http://maven.ia55.net/company was cached in the local repository,
resolution will not be reattempted until the update interval of
company-mvn-repository has elapsed or updates are forced -> [Help 1]
I read in some of the answers that this can also happen if m2e is not configured properly (it should be pointing to the commandline maven and not embedded maven). When I checked I saw that I don't even have m2e so in installed it. I don't know how to configure it to point to my Maven.
However, I doubt that this problem is because of the plugin not working otherwise I would not have been able to work in Eclipse peacefully till now.
So my other question is, isn't the success of mvn clean package enough to warrant that eclipse should not have any compilation errors regarding dependencies or does scope of dependency also plays a role and that I should work on getting the jar in the repo.
Is there any other possible issue that I am missing?
The issue got resolved. Earlier i was only importing the project that i wanted to work on. After importing all the projects in the directory which contained the pom, eclipse resolved the dependencies. Have no clue how this worked but it did.

Cannot find class in classpath: Open_MRS_POM.Open_MRS_Engine

[RemoteTestNG] detected TestNG version 6.13.0
Cannot find class in classpath
Tried almost everything mentioned in the previous blogs. Cleaned the project, updated Maven project, restarted Eclipse etc, Edited the TestNG XML file with the package name.class name as mentioned. But still the issue persists.
org.testng.TestNGException:
Try to run the test from Maven command line interface.
1. Go to the project path.
2. Enter the command "mvn clean install".
I have had this several times and this was the solution.
Note: Maven needs to be installed on PC and its environment variables have to be set.

Equivalent mvn eclipse:clean eclipse:eclipse m2e command

I have a Maven error like the following in Eclipse for a Maven project.:
Project 'project1' is missing required library: '.../.m2/repository/.../project2/0.37.0-SNAPSHOT/project2-0.37.0-SNAPSHOT.jar'
The project cannot be built until build path errors are resolved
The error is wrong, because in the parent pom.xml version 0.38.0-SNAPSHOT is defined, which also lies in the .m2 repository as project2-0.38.0-SNAPSHOT.jar
I tried: "Right click" -> "Maven" -> "Update Project...", but it does now solve the problem.
Then I tried: mvn eclipse:clean eclipse:eclipse, which solved the problem. But, then the problem is, that it converts the Eclipse Maven project to an Eclipse project. So I have to manually convert it back to an Eclipse Maven project. I also wonder because Apache Maven Eclipse Plugin is RETIRED.
Is there another solution to the above Problem?
Your error messages sais something about 0.37.0-SNAPSHOT but in your text you refere to 0.38.0-SNAPSHOT. Is it a mistake or maybe the version in your dependency is wrong?
First your are right not to mix mvn eclipse:eclipse and eclipse-m2e plug-in. Second the Maven->Update Project should fix any misconfiguration.
I would suggest to call mvn clean install in your console to verify that there are no real dependency problems. Eclipse sometimes does not update its index correctly.
Second if the error still appears try to restart your eclipse. I often saw that eclipse-m2e does cache some stra

Error: duplicate class in maven?

I am working on a maven project. when I run Maven-clean command target folder get empty its fine. but when I am trying to run Maven-install command after some modification, its showing me a compile time error.
error: duplicate class: com.d8corporation.mailservice.MailService_Service
I searched and got the following link
in second answer
So removing them from version control again, could solve it?
I have not so much experience in maven so could some one please explain me what I remove for version control?
I resolve the same issue
cleaning maven project :-mvn clean
delete com folder from src then compile
copy com from generated to src->main-->java
again compile
Hope this Help..

saucelabs java tutorial compilation errors

I'm experiencing various compile/run errors when I try the Sauce Labs Java tutorial. These errors are different when I run Maven in the command line and in Eclipse (Juno)
The java tutorial for Sauce Labs shows the Maven command to generate a JUnit based project
mvn archetype:generate -DarchetypeRepository=http://repository-saucelabs.forge.cloudbees.com/release -DarchetypeGroupId=com.saucelabs -DarchetypeArtifactId=quickstart-webdriver-junit -DarchetypeVersion=1.0.17 -DsauceUserName=username -DsauceAccessKey=access_key
The folder structure, maven pom file, and the code is generated by this command and the tutorial instructs the user to change to the newly created project folder and run the following command
mvn test
At this point I am getting a java.lang.ClassNotFoundException error. The org.junit.runner.notification.RunListener is apparently not found, even though I can see it in the Maven dependencies for the project (in Eclipse)
I am also getting an error saying that Maven cannot find the following library sauce_junit1.0.17.jar
I have found a fix to issue running mvn test from the command line. Change the DarchetypeVersion from 1.0.17 to 1.0.18 when generating the project
mvn archetype:generate -DarchetypeRepository=http://repository-saucelabs.forge.cloudbees.com/release -DarchetypeGroupId=com.saucelabs -DarchetypeArtifactId=quickstart-webdriver-junit -DarchetypeVersion=1.0.18 -DsauceUserName=username -DsauceAccessKey=access_key
I can see that the sauce_junit jar file is in my local repo for 1.0.18 but not 1.0.17

Categories