Debugging my program in IntelliJ, I can see that the dependency called registrationcore-api is being run from the latest code in GitHub. However, running mvn dependency:list from my project directory shows
[INFO] org.openmrs.module:registrationcore-api:jar:1.8.0:provided
i.e., the last release version, from last October. IntelliJ displays a warning when the debugger hits this module, saying "Source code does not match bytecode." In the editor it displays the source code for release 1.8.0.
I did recently clone registrationcore-api and do some work on it. But then I deleted the source code, and deleted the directories from the maven repository (rm -r ~/.m2/repository/registrationcore*), so that it would be downloaded on next run. Somehow, somewhere, the bytecode for the version I was working on has stuck around.
Where is it? How can I get rid of it? How is it linked in to my application, and why doesn't Maven know about it?
EDIT: I've run mvn clean and ensured that IntelliJ and the installed Maven are using the same repository location (~/.m2/repository).
Related
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.
[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.
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.
I'am trying to import a class but the Eclipse doesn't recognize the downloaded libraries. I have tried to Update my Maven's project via Maven-> Update Project it did not help. I tried to remove all dependencies except selenium-java and it did not help as well as redownloading the project from repository after a maven project update. Please need a hand, have no ideas what else should i do?
P.S. I tried to download the project on another machine and for first it didn't work but after a second attempt it went well and compiled.
Screenshot of the error:
Try inspecting /org/seleniumhq/selenium/selenium-firefox-driver/3.8.1/selenium-firefox-driver-3.8.1.jar in your local Maven repository. Perhaps it's corrupted.
You can also try building the project from command line. Simple mvn clean install in command line should print the same error as you get in Eclipse. This will confirm that you don't have problems with your Eclipse setup.
1 . Check the Build path if it looks like image
Or 2. if you can not see the highlighted class as
In this case re download the selenium jar or download another build
I am looking at an internal Maven application I am building in IntelliJ (same results in Eclipse), and everything looks perfectly clean.
I run clean and compile from IntelliJ (using IntelliJ build or using IntelliJ Maven support) and everything compiles fine.
However when I run the build from the command line (mvn clean compile) I am getting build exceptions (see below).
The command line seems to be looking for a genericized parameter (to the "with" method), which we are indeed passing in correctly. However it is complaining as if we were passing in a non-generic parameter.
Obviously mvn on the command line is using a different version of the "with" method than IntelliJ.
Is there any way to ask Maven to tell me which version of a class it is using, in terms of group, artifact and version of the containing jar?
Here is the precise error
[ERROR] \dev\try-deploy-1\src\main\java\com\victor\webui\WebUserInterface.java:[147,47]
attribute(java.lang.String,org.hamcrest.Matcher<java.lang.String>) in
org.openqa.selenium.lift.Matchers cannot be applied to
(java.lang.String,org.hamcrest.Matcher<java.lang.Object>)
Is it possible that you have another version of the class somewhere? try adding a comment on a new line in the file so the line number changes, and re-run the maven compile to see if it still gives the same line number for the error.
In Eclipse, sorry I know you are using IntelliJ, the maven build usually does an offline build that's why it's so fast. There is a way to force it to do a clean with all the jars though and I use that when I get in a bind. It is the Update Project command and it has a box to force the update of snapshots and releases. Maybe Intellij has something like that? Also I'd verify the version you are using on command line is the same as the one IntelliJ is using (I have a few versions installed). You can check Settings in IntelliJ and
mvn -v
on the command line. Finally I'd make sure the settings.xml files you are using for command line and IntelliJ are the same file.
Good luck.