missing artifact org.elasticsearch:elasticsearch:jar:5.0.0-alpha1 - maven

Even though I can see the JAR file in Maven Dependencies and in .m2/repository directory, I still get this error.
missing artifact org.elasticsearch.elasticsearch
Do you have any idea where I am doing wrong?

I have met the same question.You can try the flowing steps:
1.make sure your network is well connected.
2.go to .m2/repository,delete all the files
3.restart your project and run maven install and maven update.

After running a build from the shell (mvn clean install, etc.) and making sure the problem is caused by Eclipse - there are a few options:
First, try Project --> Clean...
Right click on the project in the Project Explorer pane and then choose Maven --> Update Project...
Disable and then re-enable Dependency Management - right click Maven --> Disable Dependency Management and then Maven->Enable Dependency Management
Close the project and then reopen it.

Related

Why intelliJ doesn't show maven dependency as External dependencies and also shows red symbols even though the dependencies are downloaded

I'm cloning my maven project from GIT and then doing mvn clean install. My dependencies are downloaded successfully, but I'm not able to see it in External Libraries. Also my code shows red colored as if dependencies are not available. I did Invalidate cache/restart, did re-cloning, removed .idea folder, but no luck.
Any solution to this?
THanks!
Make sure you have opened the Project as Maven project and that it has been imported successfully from Maven pom.xml build file. In an existing project you can import Maven from Maven tool window. See Link a Maven project
steps:
Open the Maven tool window.
In the Maven tool window, click the + icon to attach a Maven project.
In the dialog that opens, select the desired pom.xml file, and click OK.

How to fix 'Missing requirement' error in Maven on Windows

I'm trying to build dbeaver and get the following error when running mvn package:
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: org.jkiss.dbeaver.slf4j 1.0.0.qualifier
[ERROR] Missing requirement: org.jkiss.dbeaver.slf4j 1.0.0.qualifier requires 'bundle org.slf4j.api 0.0.0' but it could not be found
I'm running on Windows 10 and using apache-maven-3.6.1. The strange thing is that when I try the same steps on Linux it builds without problem.
Update
Possible cause is maven 3.6.1 https://www.eclipse.org/lists/tycho-user/msg08177.html
Original post
The problem here, I presume, is that https://dbeaver.io/eclipse-repo/ p2 site is missing slf4j bundle and Tycho (?) cannot resolve the requirement. I still do not know how to make standalone maven build work, but here is an ugly workaround on how to build Windows binary with Eclipse (and embedded maven).
You can use p2-maven-plugin to build that missing bundle yourself. Instead of setting up a brand new project, you can temporarily modify product\localRepository\pom.xml to have a single artifact like
...
<artifacts>
<artifact><id>org.slf4j:slf4j-api:1.7.26</id></artifact>
</artifacts>
...
Now build that (product\localRepository\) project and start jetty
mvn p2:site
start mvn jetty:start
Now you can add this interim update site (http://localhost:8080/site/) to your Eclipse installation (Help -> Install New Software) and install slf4j. You should already be able to run DBeaver from within Eclipse.
To build a binary, add this interim repo into main pom.xml file, e.g. right after local-contrib one.
<repository>
<id>more</id>
<url>http://localhost:8080/site/</url>
<layout>p2</layout>
</repository>
Then go to Run Configurations -> Maven Build -> dbeaver, enter package goal and tick Skip Tests, click Run and go have some coffee.
As you can see Eclipse uses some sort of embedded maven runtime, so I guess it resolves things differently.
Note that if you are updating your local git repo, you might need to update your Eclipse project big time. I was unable to do it with right clicking on the project -> Configure -> Configure and Detect Nested Projects :( But deleting Eclipse project and nested projects (without deleting underlying files) and re-importing Maven project did the trick for me.
There is also an open issue for this https://github.com/dbeaver/dbeaver/issues/6115 .

Importing to IntelliJ - Error package org.springframework.boot does not exist

Dear Stackoverflow Community, I have the following problem with my spring boot starter application. I imported the starter project as a new maven project into IntelliJ. But IntelliJ does not find the dependencies I specified in the pom.
Image of my Application Class:
If I try to run the project I get the following error message.
Image of the Error Message:
I already tried everything from re-installing IntelliJ to re-importing the project or redownloading the dependencies. I simply dont know why IntelliJ doesn´t find the dependencies.
My pom.xml looks as following
Image of my pom.xml:
The first time I tried to edit the pom.xml it said to me "this file does not belong to the project". Maybe this might be one reason.
Running the whole thing with 'mvn install' or 'mvn clean verify' works.
Try this and then build: mvn -U idea:idea
Had the same problem. I have tried everything: invalidating cache, deleting the whole .m2 folder, changing settings, reloding the project, nothing helped.
The solution for me was to delete the .iml files which are IntelliJ module files used for keeping module configuration. After reopening the project it worked.
The idea was not mine, I found the hint here: https://intellij-support.jetbrains.com/hc/en-us/community/posts/203365204--package-does-not-exist-error-despite-autocomplete-being-aware-of-them
Sometimes your workspace could get corrupted.
In my case, I tried to Reload the project and it worked
in my case changed JDK version in Maven importer from JDK 11 to my local JDK version 1.8
Here is how my IntelliJ settings for spring boot application looks like
Click open -> browse your workspace -> and select POM.xml file
Check this in your intelliJ settings
Do this too [Settings --> Maven --> Importing]
I just had the same issue. My solution was to remove all dependencies from the pom, reload via maven -> Reload All Maven Projects. Run mvn compile. Add dependencies back to the pom, maven -> Reload All Maven Projects. Run mvn compile.
Now the Intellij build works.
You need to change Maven's JDK for importing option from Project JDK to the Path variable for Java on your machine.
You can get to this by going to Settings -> Build, Execution, Deployment -> Build Tools -> Maven -> Importing. Scroll down to the bottom and look for JDK for importing:. Select from the list the path variable for JAVA.
For Windows users, JAVA_HOME should be an option in the drop-down list.
Follow these steps, your problem should be solved. You just need to add Spring-framework-starter-web and Spring-framework-starter-tester from your pom.xml file.
Got to generate(ALT+Insert)
Add dependencies
Search "springframwork"
Add...
Here is the link
In my case, adding the project as maven project helped .

Mule copies Maven dependencies into env.M2_REPO folder

I am using Anypoint Studio 6.2 with Mule 3.8.1 runtime and Maven 3.3.9 and when I build my project, the Maven dependencies are written to a project folder called ${env.M2_REPO} instead of my usual Maven repository c:/users/my.name/.m2.
How can I change it back to c:/users/my.name/.m2 and stop this folder from being created?
It is causing errors to show in the Mule Problems tab saying "missing libraries" but when I move them from the ${env.M2_REPO} folder to c:/users/my.name/.m2 the problems go away.
The issue was that in the settings.xml file in the Maven application folder, the default repository was set to env.M2_REPO instead of the .m2 location. Changed it to .m2 and all working correctly.
right click on project--> Java Build Path-->Add Variable --> configure
variables--> Classpath variables--> new
-----------OR---------------
preferences-->Java--> Build path--> classpath variables
name: M2_REPO
path: location of repo
Update1:
right click on project, you will see something like this.
first time click on
populate maven repository
..
If your problem still didn't fixed then click on
Update project dependencies
.. This is how it fixed my problem few months back.

m2eclipse says "Missing artifact" but I can build from cmdline!

I'm trying to use this Sonatype Eclipse plugin for the first time to handle an existing (huge) software that I can build with maven form the command line.
I have configured the plugin to use my maven 2.2.1 installation instead of the built-in Maven 3.
In Eclipse I have 25 projects (loaded through the root pom.xml) and 4 of them have compilation errors; the maven console contains a lot of lines like this one:
Missing artifact commons-logging:commons-logging:jar:1.0.4:compile
I have all the jars in my repository and the M2_REPO classpath variable correctly defined. Why the plugin doesn't see all the jars?
The .classpath file of those projects simply references "MAVEN2_CLASSPATH_CONTAINER", there isn't a list of the jars.
The pom.xml in Eclipse shows an error on the first line for the missing jars but I can build from the command line!
Any idea? I need help! I will try to move to NetBeans if I don't solve this problem.
Thank you.
You may need to to tell Eclipse to force update:
Project -> Maven -> Update Maven Project
and then make sure you have selected:
Force Updates of Snapshots/Releases
this happens when mvn install copies some jar files into Maven repository and Eclipse had checked this repo BEFORE this jar has been copied there.
If Dependency management is enabled when the above problems occur in Eclipse you can Project > Maven > Disable Dependency Management and then \Project > Maven > Enable Dependency Management. This normally remove any dependency errors in the pom.xml.
Also do as #Nishant indicated in his answer above after the above steps to complete the projects dependencies.
right click on your project > Maven > Update Dependencies
then
right click on your project > Maven > Update Project configuration
Assuming you M2Eclipse plugin is installed correctly this should solve the issue. Also, check if there is an option right click project > Maven > Enable dependency Management select that.
Using Eclipse Kepler, the removing and re-adding of the maven nature fixed this same issue I was having. What this process actually did was modify the .settings/org.eclipse.m2e.core.prefs file, changing the line
resolveWorkspaceProjects=false
to
resolveWorkspaceProjects=true
So you could probably make this change manually if you had to.
Adding my 2c for future Googlers:
Whenever this problem shows up, I delete the corresponding folder from the m2 repository (on a mac it's on ~/.m2/repository) and build again from eclipse with clean install.
Works every single time.
Close eclipse IDE and open it again, this issue should be fixed.
Just to add yet another possible resolution, if you have a multi-project build with interdependencies, if you have a repository defined in a child project pom to resolve a specific dependency that only that project depends on and it is relying on a partent project for it's other resolutions it fails to see those dependencies in the child project (even though it works from the command line).
Move the repo definition to the parent pom.
The lack of jars in the build path suggests you haven't enabled Maven dependencies. Right-click on the project, select Maven, select "Enable Maven Dependency Management". This allows M2Eclipse to reference your POM.
I finally found a workaround. It is surely a bug in m2eclipse, however the problem disappeared when I added quartz-1.6.0.pom next to quartz-1.6.0.jar in .m2\repository\opensymphony\quartz\1.6.0\
The pom is not present at http://repo1.maven.org/maven2/opensymphony/quartz/1.6.0/ but you can extract it from quartz-1.6.0-bundle.jar linket at http://jira.opensymphony.com/browse/QUARTZ-482
It's a strange solution but it worked on the PCs of my collegues too.
None of the other suggestions worked, but the following steps worked for me (SpringSource Tool Suite 2.6.1):
Back up the contents of the local Maven repository
Delete the repository
Project > Maven > Update Dependencies
Replace anything not available in a public repository from the backup
If disabling and enabling project dependency management doesn't help (usualy it helps) you can modify .classpath file in your project and add a line:
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
After eclipse restart dependencies should be added.
I had this same problem happened to me. On the CLI clean install, then on eclipse delete the dependency, paste it again and that did the trick.
Remove all the artifacts except the jar in maven local repository
Late answer: In my case I had multiple profiles in settings.xml. Building worked since the correct profile was selected in the Maven Build run config, but the editors showed errors because the profile was not selected via Project -> Maven -> Select Maven Profiles ...

Resources