Maven - Cannot resolve net.dv8tion:JDA:4.3.0_234 - java

I try to code a discord bot, but i have an issue while making the project.
<dependencies>
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>4.3.0_234</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>dv8tion</id>
<name>m2-dv8tion</name>
<url>https://m2.dv8tion.net/releases</url>
</repository>
</repositories>
net.dv8tion, JDA and the VERSION number are in red, i have no clue how to fix this. I tried to reload Maven, reload intellij but nothing helps.

Related

Cannot resolve com.palantir.docker.compose:docker-compose-rule-junit4:0.32.0

Trying to drag this dependency from maven but get error, what could be the issue?
Cannot resolve com.palantir.docker.compose:docker-compose-rule-junit4:0.32.0
<dependency>
<groupId>com.palantir.docker.compose</groupId>
<artifactId>docker-compose-rule-junit4</artifactId>
<version>0.32.0</version>
</dependency>
The packet did not exist in maven central repo https://repo.maven.apache.org/maven2, so I had to add extra one.
<repositories>
<repository>
<id>Palantir</id>
<url>https://dl.bintray.com/palantir/releases/</url>
</repository>
</repositories>

EnableEurekaServer import doesn't exist

I build a Spring-Service with gradle and I wanted to use a Eureka-Server with it.
My java-file looks like this:
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
#EnableEurekaServer
public class Welcome {
....
}
but when I try to build it with my gradle-file it says:
org.springframework.cloud.netflix.eureka.server does not exist
I searched for a solution for this problem but I seem to be alone with it. Does someone know why it is not working? Do I have to write something specific into the build.gradle-file?
The following dependency worked for me:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix-eureka-server</artifactId>
<version>1.1.6.RELEASE</version>
</dependency>
Assuming you use a bill of materials to manage Spring Cloud dependencies:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Just add the following depedency to your project:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId>
</dependency>
Spring Cloud releases have names instead of numbers. And you must ensure that Spring Cloud version is compatible with the Spring Boot version you are using. See more details here.
Well if you are using gradle project, just add below dependency to your build.gradle file:
compile('org.springframework.cloud:spring-cloud-netflix-eureka-server')
Specify repository in pom if missing:
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
Make sure that you havespring-cloud-starter-netflix-eureka-server added in your pom.xml file
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
Adding this dependency worked for me.
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix-eureka-server</artifactId>
<version>3.1.2</version>
</dependency>

Missing artifact in maven internal repository

I have added two jar files to my internal repository and created its corresponding folder directory as shown below in image. but it is showing compile time error in my pom.xml where i have added the dependency for both the jars, saying "Missing artifact common:common-jar:jar:1.0" and "Missing artifact mediator:mediator-jar:jar:1.0"
look at my pom.xml below
<properties>
<jdk.version>1.7</jdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Maven plugin & MOJO versions -->
<version.maven-compiler-plugin>3.1</version.maven-compiler-plugin>
</properties>
<repositories>
<repository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${basedir}/libs</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>common</groupId>
<artifactId>common-jar</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>mediator</groupId>
<artifactId>mediator-jar</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
please suggest what to do.
I think there is some problem identifying value for ${basedir} but i have also tried ${project.basedir} as well, it is also not working.
The problem lies in your url tag. Instead of <url>file://${basedir}/libs</url> try removing the double slash before ${basedir}: <url>file:${basedir}/libs</url>
You have a nice guide here if you want to check it.
First : Never use <scope>system</scope>
Follow the Example:
Project folder - C:\UX\X5SCX\GIT_STORE\SRC\FACTOR\fwk\broker\lib
<repositories>
<repository>
<id>local-repo</id>
<url>file://${basedir}/lib</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>ews</groupId>
<artifactId>ews-java-api</artifactId>
<version>2.0</version>
</dependency>
</dependencies>

Spring-data-elasticsearch maven dependency not found

I clone repository from https://github.com/spring-projects/spring-data-elasticsearch/blob/master/pom.xml
In pom.xml I have:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>1.0.0.M2</version>
</dependency>
but maven can not find this lib in repository.
I also try: https://github.com/spring-projects/spring-data-elasticsearch
but it is the same spring-data-elasticsearch version.
I'm assuming you're using Maven Central as your repository. I didn't see it there either.
According to the project site, spring-data-elasticsearch is available at http://repo.spring.io/libs-milestone. Did you try this repo?
Try to use the following repository.
<repositories>
<repository>
<id>spring-snapshot</id>
<name>Spring Maven SNAPSHOT Repository</name>
<url>http://repo.springsource.org/libs-snapshot</url>
</repository>
</repositories>
Dependency
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>1.0.0.M1</version>
</dependency>
I try once again after few hours and It works. Seriously I have no idea why. Correct configuration is:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>1.0.0.RC1</version>
</dependency>
<repository>
<id>spring-libs-milestone</id>
<name>Spring Milestone Repository</name>
<url>http://repo.spring.io/libs-milestone</url>
</repository>
I am not understanding where is the confusion here ?
Project is not yet fully released hence it's still using milestone repo of springsource instead of maven central repo. It will get released within 2 weeks with Spring Data release train Dijkstra.
Spring Data Elasticsearch GitHub page stats that
Maven configuration
Add the Maven dependency:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>1.0.0.RC1</version>
</dependency>
<repository>
<id>spring-libs-milestone</id>
<name>Spring Milestone Repository</name>
<url>http://repo.spring.io/libs-milestone</url>
</repository>
If you'd rather like the latest snapshots of the upcoming major version, use our Maven snapshot repository and declare the appropriate dependency version.
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
</dependency>
<repository>
<id>spring-libs-snapshot</id>
<name>Spring Snapshot Repository</name>
<url>http://repo.spring.io/libs-snapshot</url>
</repository>

Cannot build Spring 4 project with Maven

I am going through this guide:
https://spring.io/guides/gs/rest-service/
I use Maven for building, so I've fetched the pom.xml linked in the official Spring guide:
https://github.com/spring-guides/gs-rest-service/blob/master/initial/pom.xml
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework</groupId>
<artifactId>gs-rest-service</artifactId>
<version>0.1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.0.1.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
</dependencies>
<properties>
<start-class>hello.Application</start-class>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-build</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<repository>
<id>spring-repo</id>
<name>Spring Repository</name>
<url>http://repo.spring.io/release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</project>
I get the following error when running mvn install
[ERROR] Error resolving version for plugin
org.springframework.boot:spring-boot-maven-build' from the
repositories [local (C:\Users\Laszlo_Szucs.m2\repository),
spring-snapshots (repo.spring.io/libs-snapshot), central
repo.maven.apache.org/maven2)]: Plugin not found in any plugin
repository -> [Help 1]
How do I know which version to provide in the pom.xml for this?
Check whether http://repo.spring.io/libs-snapshot is in pom.xml. If not, Add http://repo.spring.io/libs-snapshot to maven repository.
<repository>
<id>spring-repo</id>
<name>Spring Repository</name>
<url>http://repo.spring.io/release</url>
</repository>
And upgrade the maven to 3.0.5 above.
In my case, removing the ~/.m2/repository/org/springframework/boot folder and then cleaning the project resolved the issue. After this issue, I also faced another issue in which STS complained that my maven project was not updated. However, right clicking on the issues in the Markers area and selecting Quick Fix popped up a window which prompted me to update the maven projects. Selecting the projects and clicking the update button in this window resolved the issue.
I specified d goals as "spring-boot:run" (without quote) it works for me
procedure: right click on myproject>run as >run configurations >click on mavenbuild>goals(specify goal name)>run

Categories

Resources