0

I just made a new spring starter project and I keep getting this error:

Project build error: 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter:pom is missing

My full POM.xml is as follows:

 <?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>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.19.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <groupId>com.example</groupId>
    <artifactId>AOP_demo-3</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>AOP_demo-3</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <repositories>
    <repository>
        <id>central-repo</id>
        <name>Central Repository</name>
        <url>http://repo1.maven.org/maven2</url>
    </repository>
</repositories>

    <dependencies>
    <dependency>   
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <version>1.5.7.RELEASE</version>
    </dependency>
        <dependency> <!-- error is here -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <type>pom</type>
            <scope>runtime</scope>
        </dependency>

        <dependency>  <!-- error is here -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <type>pom</type>
            <scope>runtime</scope>
        </dependency>
    </dependencies> 

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>
Barath
  • 5,093
  • 1
  • 17
  • 42
siri
  • 95
  • 2
  • 11

1 Answers1

1

corrected pom should be like below. There are couple of issues in your pom by specifying <type>pom</type>.

 <?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>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.19.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <groupId>com.example</groupId>
    <artifactId>AOP_demo-3</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>AOP_demo-3</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <repositories>
    <repository>
        <id>central-repo</id>
        <name>Central Repository</name>
        <url>http://repo1.maven.org/maven2</url>
    </repository>
</repositories>

    <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>          
        </dependency>
    </dependencies> 

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>


Barath
  • 5,093
  • 1
  • 17
  • 42
  • Thank you! That did fix my current problem. However now I notice that it keeps downloading from "https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-maven-plugin/1.5.19.RELEASE/spring-boot-maven-plugin-1.5.19.RELEASE.pom" However I need it to be http – siri Feb 21 '19 at 16:59
  • Does it have any issue?. It is because those repositories will be present in super POM, you can find it in effective pom section. More details can be found here [multiple repositories](https://maven.apache.org/guides/mini/guide-multiple-repositories.html) – Barath Feb 21 '19 at 17:03
  • "Could not transfer artifact org.springframework.boot:spring-boot-maven-plugin:pom:1.5.19.RELEASE from/to central (https://repo.maven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target" – siri Feb 21 '19 at 17:04
  • You will also get the standard set of repositories as defined in the Super POM. The other way you can specify the use of multiple repositories by creating a profile in your ${user.home}/.m2/settings.xml file like the following: – Barath Feb 21 '19 at 17:05
  • Refer this [SO](https://stackoverflow.com/questions/21252800/how-to-tell-maven-to-disregard-ssl-errors-and-trusting-all-certs) for skipping SSL issues – Barath Feb 21 '19 at 17:06
  • I was able to fix the https issue I think. Now I am getting this:Plugin org.springframework.boot:spring-boot-maven-plugin:1.5.19.RELEASE or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.springframework.boot:spring-boot-maven-plugin:jar:1.5.19.RELEASE: Could not transfer artifact org.springframework.boot:spring-boot-maven-plugin:pom:1.5.19.RELEASE from/to central (http://repo1.maven.org/maven2): proxy.example.com: Unknown host proxy.example.com – siri Feb 21 '19 at 17:20
  • you are running behind a proxy I believe. search for maven proxy settings to figure it out. Lets not spam this question anymore. – Barath Feb 21 '19 at 17:22