Project build error: 'dependencies.dependency.version' for org.springframework.cloud:spring-cloud-starter-eureka-server:jar is missing
Asked Answered
D

20

21

I am developing a code from https://www.dineshonjava.com/microservices-with-spring-boot/. When I update the spring-boot-starter-parent from 1.5.4.RELEASE to 2.0.4.RELEASE, build got failed.

Could anyone please guide me what is the issue ?

Project build error: 'dependencies.dependency.version' for org.springframework.cloud:spring-cloud-starter-eureka-server:jar is missing.

Another error:

Multiple annotations found at this line:
    - For artifact {org.springframework.cloud:spring-cloud-starter-eureka-server:null:jar}: The version cannot be empty. (org.apache.maven.plugins:maven-resources-plugin:3.0.2:resources:default-resources:process-
     resources) org.apache.maven.artifact.InvalidArtifactRTException: For artifact {org.springframework.cloud:spring-cloud-starter-eureka-server:null:jar}: The version cannot be empty. at 
     org.apache.maven.artifact.DefaultArtifact.validateIdentity(DefaultArtifact.java:148) at org.apache.maven.artifact.DefaultArtifact.<init>(DefaultArtifact.java:123) at 
     org.apache.maven.artifact.factory.DefaultArtifactFactory.createArtifact(DefaultArtifactFactory.java:157) at org.apache.maven.artifact.factory.DefaultArtifactFactory.createDependencyArtifact(DefaultArtifactFactory.java:
     57) at org.apache.maven.project.artifact.MavenMetadataSource.createDependencyArtifact(MavenMetadataSource.java:328) at 
     org.apache.maven.project.artifact.MavenMetadataSource.createArtifacts(MavenMetadataSource.java:503) at 

pom.xml

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter</artifactId>
        </dependency>
        <!-- Eureka registration server -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka-server</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <!-- <version>Camden.SR5</version> -->
                <version>Finchley.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
Davies answered 19/8, 2018 at 19:17 Comment(2)
Dependencies were renamed, include Netflix nowadays.Autoeroticism
@Autoeroticism - Could you please post corrected maven dependencies? I think something has change majorly post 2.0.0.RELEASEDavies
A
21

As indicated in my comment, some starters were renamed: https://github.com/spring-projects/spring-cloud/wiki/Spring-Cloud-Edgware-Release-Notes

A number of starters did not follow normal Spring Cloud naming conventions. In Edgware, use of the deprecated starter will log a warning with the name of the new starter to use in its place.

So change: spring-cloud-starter-eureka-server to spring-cloud-starter-netflix-eureka-server.

Autoeroticism answered 21/8, 2018 at 5:12 Comment(3)
Even after renaming, issue still persists.Mcburney
I am already using "spring-cloud-starter-netflix-eureka-server" but it still has issueIngmar
@FaizanMubasher add this dependency management in pom.xml <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>Sydneysydnor
H
12
Add the following in to your pom.xml  

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <spring-cloud.version>Hoxton.RC1</spring-cloud.version>
</properties>

    <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </dependency>

    OR

    <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
    </dependency>

    <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>

    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
        </repository>
    </repositories>
Headrace answered 31/10, 2019 at 23:23 Comment(1)
It doesn't work with spring-cloud-starter-netflix-hystrix toDramamine
N
6

1º) remove dependency from your pom.xml and save the file;

2º) Go to the STS project > right click > Spring > Edit Starters > search to Eureka Discovery Client and mark checkbok > OK.

This action solved my problem.

Niphablepsia answered 5/5, 2020 at 11:50 Comment(0)
F
5

Add the following int the Pom.xml

<properties>
        <java.version>1.8</java.version>
         <spring-cloud.version>Greenwich.RELEASE</spring-cloud.version>
 </properties>

<dependencies>
<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>

    </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>
Fairhaired answered 19/4, 2020 at 6:22 Comment(0)
L
3

I also was facing similar problem. Using the below pom.xml helped

<properties>
    <java.version>1.8</java.version>
    <spring-cloud.version>Hoxton.SR3</spring-cloud.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>   

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-openfeign</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
    </dependency>

    <dependency>
         <groupId>org.springframework.cloud</groupId>
         <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
        <optional>true</optional>
    </dependency>

    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

</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>
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
Lanneret answered 18/4, 2020 at 10:40 Comment(0)
H
2

Even I got the similar error when I was adding dependency for hystrix.

Error : Project build error: 'dependencies.dependency.version' for org.springframework.cloud:spring-cloud-starter-hystrix:jar is missing

It worked after changing netflix <artifactId>

from: spring-cloud-starter-hystrix 
to:   spring-cloud-starter-netflix-hystrix
Huntress answered 28/11, 2019 at 17:46 Comment(1)
Hello Ravikumar, welcome to StackOverflow. I have remove your bold characters formatting because is too agressive and I have formatted your question differently in using back character ` to put text on grey background. I have also used code formatting so that comparaison between incorrect code and correct code in artifactId is immediate. You can see what I have already done in clicking on edit button just below your question. I hope that can help your for your next post.Imprecate
A
2

There are a couple of things here. I was trying to create the Eureka server and I faced a couple of problems.

First things

If you are using spring-cloud-starter-eureka-server then change it to spring-cloud-starter-netflix-eureka-server.

The link will give the details of the changes. https://github.com/spring-projects/spring-cloud/wiki/Spring-Cloud-Edgware-Release-Notes

I recently created the starter project from https://start.spring.io/ and it has the latest changes in pom.xml

This is how it looks like

<dependency>
 <groupId>org.springframework.cloud</groupId>
 <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

<dependency>
 <groupId>org.springframework.cloud</groupId>
 <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>

You need to make sure that the eureka server dependency version is correct. You can make sure by adding <spring-cloud.version>Greenwich.RELEASE</spring-cloud.version> in properties tag and ${spring-cloud.version} in dependencyManagement's version tag

If you do not see the <dependencyManagement> tag then add the whole dependency in your pom.xml

<properties>
    <java.version>1.8</java.version>
     <spring-cloud.version>Greenwich.RELEASE</spring-cloud.version>
 </properties>

	<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>

I hope it helps.

Aerodynamics answered 5/6, 2020 at 12:20 Comment(0)
F
1

After setting the version:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    <version>3.0.0</version>
</dependency>

the error disappeared. Probably not the best solution for production.

Forestry answered 26/1, 2021 at 12:4 Comment(0)
O
1

Try adding bellow global version,

<properties>
    <java.version>11</java.version>
    <spring-cloud.version>2020.0.2</spring-cloud.version>
</properties>

Then the dependency without version tag as bellow,

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>

This may help some.

Overline answered 2/4, 2021 at 11:48 Comment(0)
S
1

For all those who still having the error after trying above mentioned troubleshooting, they can add this dependency management in pom.xml, it should work.

<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>
Sydneysydnor answered 12/12, 2022 at 16:0 Comment(0)
A
0

I tried all the answers posted above and none of them work. The only bulletproof method which worked for me is to create a demo project at https://start.spring.io/ and choose the dependencies Eureka Discovery Client SPRING, then see the pom.xml of the demo project and compare with your current POM.

The demo pom.xml generated from start.spring.io is posted below, I have included comments to list the code I was missing in my XML and upon including I was able to get the compile it successfully.

    <?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <parent>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-parent</artifactId>
          <!-- Update the Spring version in current POM -->
          <version>2.6.0</version>
          <relativePath/> <!-- lookup parent from repository -->
      </parent>
      <groupId>com.example</groupId>
      <artifactId>demo</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <name>demo</name>
      <description>Demo project for Spring Boot</description>
      <properties>
          <java.version>11</java.version>
          <!-- Missing, include this -->
          <spring-cloud.version>2021.0.0-RC1</spring-cloud.version>
      </properties>
      <dependencies>
          <!-- Missing, include this -->
          <dependency>
              <groupId>org.springframework.cloud</groupId>
              <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
          </dependency>
  
          <dependency>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-test</artifactId>
              <scope>test</scope>
          </dependency>
      </dependencies>
      <!-- Missing, include this -->
      <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>
  
      <build>
          <plugins>
              <plugin>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-maven-plugin</artifactId>
              </plugin>
          </plugins>
      </build>
      <!-- Missing, include this -->
      <repositories>
          <repository>
              <id>spring-milestones</id>
              <name>Spring Milestones</name>
              <url>https://repo.spring.io/milestone</url>
              <snapshots>
                  <enabled>false</enabled>
              </snapshots>
          </repository>
      </repositories>
  
  </project>

Please include the differences in your current XML.

Afield answered 20/11, 2021 at 23:12 Comment(0)
P
0

I Find the solution by trying two things and both solved the problem, I guess it is the issue with the netflix-eureka server version.

Method 1: Simply Use JDK 11.

Method 2: If you are using JDK 8. Then add this version tag with version 3.0.0,

<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
            <version>3.0.0</version>
</dependency>

this is though not the best practice and will give the warning of

Overriding managed version 3.1.1 for spring-cloud-starter-netflix-eureka-server

however, it will remove the error.

Polystyrene answered 19/2, 2022 at 13:39 Comment(0)
T
0

adding this in pom.xml after dependencies node worked for me.

<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>
Thermosphere answered 11/8, 2022 at 20:51 Comment(0)
H
0

This worked for me: I changed my starter parent version from 3.0.0 to 2.7.3 and cloud version to 2021.0.3

    <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.7.3</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

   <properties>
    <java.version>17</java.version>
    <spring-cloud.version>2021.0.3</spring-cloud.version>
</properties>
Hunger answered 8/12, 2022 at 8:51 Comment(0)
C
0

Resolved after adding spring-cloud-dependencies and the netflix repositories complete pom.xml as below

4.0.0 org.springframework.boot spring-boot-starter-parent 3.0.0 com.rh movie-catalog-service 0.0.1-SNAPSHOT MovieCatalogue movie catalogue service

<properties>
    <java.version>11</java.version>
    <spring-cloud.version>2022.0.0-RC2</spring-cloud.version>           
</properties>

<dependencies>


    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>               
    
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </dependency>
    
</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>
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
<repositories>
    <repository>
        <id>netflix-candidates</id>
        <name>Netflix Candidates</name>
        <url>https://artifactory-oss.prod.netflix.net/artifactory/maven-oss-candidates</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>spring-milestones</id>
        <name>Spring Milestones</name>
        <url>https://repo.spring.io/milestone</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>
Cassis answered 9/12, 2022 at 12:40 Comment(0)
S
0

If nothing works, then the problem is in your maven settings. Check Maven Settings: Verify that IntelliJ IDEA is using the correct Maven installation and settings. Go to "File" -> "Settings" -> "Build, Execution, Deployment" -> "Build Tools" -> "Maven". Ensure that the "Maven home directory" points to the correct location where Maven is installed on your system. Change to Bundled (Maven 3). The problem will disappear then

Salita answered 17/5, 2023 at 5:9 Comment(0)
S
0

I got that same error. My pom like bellow

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.1.0</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.thusitha</groupId>
<artifactId>department-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>department-service</name>
<description>Demo project for Spring Boot</description>
<properties>
    <java.version>17</java.version>
</properties>
<dependencies>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <excludes>
                    <exclude>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok</artifactId>
                    </exclude>
                </excludes>
            </configuration>
        </plugin>
    </plugins>
</build>

So I have to changed my pom like this.

<properties>
    <java.version>17</java.version>
    <!-- Add spring cloud verion --> 
    <spring-cloud.version>2022.0.3</spring-cloud.version>
</properties>
<dependencies>
</dependencies>
<!-- Add dependencyManagement --> 
<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>

dependencyManagement is just a declaration, and it does not really add a dependency.

Swoop answered 8/6, 2023 at 15:42 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Eupepsia
T
0

Update your pom.xml file as following

<properties>
    <spring-cloud.version>2023.0.0</spring-cloud.version>
</properties>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

<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>

This has solved the same issue.

Tamalatamale answered 10/3, 2024 at 4:33 Comment(0)
D
0

In my case there were two missing things in the pom.xml file

  1. <spring-cloud.version> in the properties tag
  2. <dependencyManagement> tag, which as to be created outside the <dependencies> tag

Code

<properties>
    <java.version>17</java.version>
    <spring-cloud.version>2023.0.1</spring-cloud.version>
</properties>

<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>
Dichroscope answered 23/5, 2024 at 21:31 Comment(0)
L
-1

Update


Hoxton.RC1


to


Greenwich.RELEASE

*** in pom.xml

Laryssa answered 5/4, 2020 at 12:15 Comment(1)
the question snippet does not list Hoxton.RC1Spouse

© 2022 - 2025 — McMap. All rights reserved.