EnableEurekaServer import doesn't exist - java

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>

Related

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

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.

Sikuli Screen constructor giving error :Cannot instatiate the type screen

Sikuli dependency version in maven is:
<dependency>
<groupId>org.sikuli</groupId>
<artifactId>sikuli-api</artifactId>
<version>1.2.0</version>
</dependency>
I am trying to do coding for image comparison using Sikuli API but getting error on:
Screen s =new Screen();
even though Screen() constructor does exist for Screen class in Sikuli.
Please try this instead:
<repositories>
<repository>
<id>snapshot</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.sikulix</groupId>
<artifactId>sikulixapi</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
I think what you are using point to another project.
Go to https://jar-download.com/?search_box=sikuli and download the jar.
Create java project and add build path.
Please try the following:
<dependency>
<groupId>com.sikulix</groupId>
<artifactId>sikulixapi</artifactId>
<version>2.0.4</version>
</dependency>

Can not import WebSocketStompClient class - STOMP + SockJS java Client

I am trying to create Java WebSocket client (STOMP + sockJs) following
this sample. But I am not able to find maven/gradle dependency for
org.springframework.web.socket.messaging.WebSocketStompClient
Even maven search did not give any results.
After some searching I found that this is a part of
4.2.0.BUILD-SNAPSHOT
and the javadoc for this class is here.
I have tried to import
org.springframework:spring-messaging:4.2.0.BUILD-SNAPSHOT
and
org.springframework:spring-web:4.2.0.BUILD-SNAPSHOT
But I was not able to import this class.
I want to know if it is possible to import the 4.2.0.BUILd-SNAPSHOT from gradle.
If it is possible how do I know which spring module (like spring-web / spring-messaging) from the javadoc?
EDIT : am I correct in assuming that it is part of 4.2.0 from the Javadoc URL?
You need to add the snapshot repository if you want to use them:
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.2.0.BUILD-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>http://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
Please add this in your POM.xml :Please match the version with your Spring-framework version.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
Then do a mvn clean && mvn install from console if you are on linux or maven install from Eclipse.
I was not able to import 4.2.0.BUILD-SNAPSHOT but I was able to import 4.2.0.RC1 release.
I checked the pom.xml of the sample and just imported the same version as it is.

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>

Categories

Resources