maven/eclipse dependency help please - java

I just tried to update my JFreeChart in Maven from:
<dependency>
<groupId>jfreechart</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.0</version>
</dependency>
to
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.15</version>
</dependency>
On Maven Project Update - it says it can't find the artifact.
SO I TRIED TO GO BACK by editting the POM again to the old dependency.
Now on Maven Update it still says it can't find 1.0.15 artifact!!!!
In BuildPath>Libraries>Maven Dependencies jFreeChart1.0.15 is still should BUT all buttons are disabled so I can't remove it.

Right click on your project, then click on Maven->Update Project. Should help.

Try to configure your maven plugin to use maven central repository.

Related

How to add an external library in maven intellij

I copied some code from github and I have a problem with libraries. My code looks like:
When i click on Authentication to add a maven dependency
it shows that there is no results
What I do wrong? Should I install anything before clicking "add maven dependency" ?
Add
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>5.4.0</version>
</dependency>
To your pom.xml
Or just search for another dependency. https://mvnrepository.com/
You need to add maven dependency in pom file:
https://mvnrepository.com/artifact/org.springframework.security/spring-security-core

package org.springframework.cloud.netflix.zuul does not exist

I am moving some test code from an older jHipster project to a new one. The old project uses the org.springframework.cloud.netflix.zuul library, specifically org.springframework.cloud:spring-cloud-netflix-core:1.3.0.RELEASE .
I put the below in my new project's pom.xml:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zuul</artifactId>
<version>1.3.0.RELEASE</version>
</dependency>
However, it seems to be pulling in org.springframework.boot:spring-boot:2.2.5.RELEASE. This release does not contain zuul in it however, as this code fails import org.springframework.cloud.netflix.zuul.
Does anyone know a fix or workaround?
Old library.
org.springframework.cloud:spring-cloud-netflix-core:1.3.0.RELEASE
My new project is using
org.springframework.boot:spring-boot:2.2.5.RELEASE
UPDATE:
Sorry I updated my question - my pom file already has this code. But it is very weird to me that even though I put to 1.3.0, I can see in my maven dependencies that it's pulling in 2.2.5. Also when I right click my project, I see maven - reimport and maven - generate sources etc.. I don't see a update project. And clicking both of those doesn't seem to downgrade it to 1.3.0
If you update your pom.xml file your problem would solve.
In your pom.xml file you'll see dependencies tag you need to add the library you want and then right click your project and say maven -> update project
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix-core</artifactId>
<version>1.3.0.RELEASE</version>
</dependency>
</dependencies>
Add following dependency to your pom.xml
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
<version>2.1.3.RELEASE</version>
</dependency>
Upgrading spring-boot to >= 2.5 requires some extra configuration in order for Zuul to keep working, see:
https://gist.github.com/aldobongio/6a22f49863c7a777612f7887bbb8fd1d

Dependency isn't recognized in Intellij

I have a problem with my MAVEN.I have added this dependency com.fasterxml.jackson.datatype.jsr310.JSR310 in the pom.xml and I wanted to import it in one class.But this dependency isn't imported.It seems that the dependency in the pom isn't recognized.How can I resolve this issue, please?
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.5.0</version>
</dependency>
<!-- CSV -->
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-csv</artifactId>
<version>2.5.3</version>
</dependency>
Did you add maven support to project?
enable auto-import in settings|
try mvn clean-install in console
in tab "maven projects" try to "reimport all maven projects"
Have you tried to "Re-import All Maven Projects"? It's the blue circular button on the "Maven Projects" tab.

Building a picketlink app

I like to build (mvn clean install) the picketlink example on
https://github.com/picketlink/TODO
But it wont work because the dependency picketlink-extension 3.0.0 isnt available in any repository.
Can anyone give me a hint what im doing wrong?
You could try to change
<dependency>
<groupId>org.picketlink.extensions</groupId>
<artifactId>picketlink-extensions-core</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
to
<dependency>
<groupId>org.picketlink.extensions</groupId>
<artifactId>picketlink-extensions-core</artifactId>
<version>3.0.0-2013Feb08</version>
</dependency>
or anything newer from Maven Repository

Maven error when resolving dependency

I am new to Maven and am trying to set up one of my first POMs. My application will cache using EhCache. Going to Maven Central Repo (link here) I copy-n-pasted the <dependency> tag and copy it into my pom.xml like so:
...many dependencies above this point
<dependency>
<scope>compile</scope>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.0.1.Final</version>
</dependency>
<dependency>
<scope>compile</scope>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<scope>compile</scope>
<groupId>jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>3.5.3</version>
</dependency>
...many dependencies below this point
When I save the changes, Eclipse builds the workspace and gives me an error on the opening <dependency> tag for EhCache 2.5:
Missing artifact net.sf.ehcache:ehcache:jar:2.5.0
So I figured that perhaps v.2.5.0 has something wrong with it, and repeated the same for 2.4.7 (the last 2.4.x release before 2.5.0). Same deal.
Since I'm so new to Maven, I don't even know where to begin looking. I tried Project >> Clean and even restarted Eclipse to see if it was just a typical Eclipse "quirk". Nope.
I am thinking:
Could EhCache be publishing bad JARs to the Maven repo?
Could Maven Repo have something wrong with it?
Could this be due to something else configured wrong in my pom.xml?
Could this be a "JAR hell" issue where I have a conflict somewhere on my dependency graph?
How would SO start tackling this problem? Thanks in advance!
It is usually safer to refer to search.maven.org. Dependency from there:
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.5.0</version>
<type>pom</type>
</dependency>
Mind type pom. From module's pom:
This is a pom artifact to pull in ehcache-core and ehcache-terracotta
for clustering. Make sure to set 'type' to 'pom' in your dependency.
Aparently when someone does not need terracotta, ehcache-core will do perfectly fine as other answer states.
They use ehcache-core in the official documentation. Maven Central does not have a jar artifact for ehcache 2.5 which explains your error message.
Using ehcache-core changes the dependency to:
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.5.0</version>
</dependency>
Which successfully downloads on my machine (ehcache does not).
I dropped this into IntelliJ and it found it. I suspect there is something wrong with your settings. Try creating a project with only this dependency in it. If it fails to download, I would check your setting. e.g. .m2/settings.xml Are you using a Nexus server or maven proxy/cache?
BTW: A simpler way to search for JARs is to use http://mvnrepository.com/ which will find all the available versions and show you the XML you need to add.

Categories

Resources