The POM for org.springframework.security:org.sprin

2019-06-17 06:21发布

问题:

When including into pom.xml

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>org.springframework.security.web</artifactId>
    <version>3.0.5.RELEASE</version>
</dependency>

with repositories

    <repository>
        <id>com.springsource.repository.bundles.milestone</id>
        <name>EBR Spring Milestone Repository</name>
        <url>http://repository.springsource.com/maven/bundles/milestone</url>
    </repository>
    <repository>
        <id>org.springframework.maven.milestone</id>
        <name>Maven Central Compatible Spring Milestone Repository</name>
        <url>http://maven.springframework.org/milestone</url>
    </repository>
    <repository>
        <id>com.springsource.repository.bundles.release</id>
        <name>EBR Spring Release Repository</name>
        <url>http://repository.springsource.com/maven/bundles/release</url>
    </repository>
    <repository>
        <id>com.springsource.repository.bundles.external</id>
        <name>EBR External Release Repository</name>
        <url>http://repository.springsource.com/maven/bundles/external</url>
    </repository>

I get the following error message when doing the maven build:

The POM for org.springframework.security:org.springframework.security.web:jar:3.0.5.RELEASE is missing, no dependency information available

Other spring libraries are included well. What's going wrong? Thank you for any help.


Update

I simplified pom.xml to

<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>test</artifactId>
<packaging>jar</packaging>
<version>1.0.1</version>
<name>test</name>
<url>http://test</url>
<dependencies>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>org.springframework.security.web</artifactId>
        <version>3.0.5.RELEASE</version>
    </dependency>
</dependencies>

<repositories>
    <repository>
        <id>com.springsource.repository.bundles.milestone</id>
        <name>EBR Spring Milestone Repository</name>
        <url>http://repository.springsource.com/maven/bundles/milestone</url>
    </repository>
    <repository>
        <id>org.springframework.maven.milestone</id>
        <name>Maven Central Compatible Spring Milestone Repository</name>
        <url>http://maven.springframework.org/milestone</url>
    </repository>
    <repository>
        <id>com.springsource.repository.bundles.release</id>
        <name>EBR Spring Release Repository</name>
        <url>http://repository.springsource.com/maven/bundles/release</url>
    </repository>
    <repository>
        <id>com.springsource.repository.bundles.external</id>
        <name>EBR External Release Repository</name>
        <url>http://repository.springsource.com/maven/bundles/external</url>
    </repository>
</repositories>
</project>

and when calling mvn -U install (forces update check) it gives

[ERROR] Failed to execute goal on project test: Could not resolve dependencies for project test:test:jar:1.0.1: Could not find artifact org.springframework.security:org.springframework.security.web:jar:3.0.5.RELEASE in com.springsource.repository.bundles.milestone (http://repository.springsource.com/maven/bundles/milestone)

回答1:

I see that the repository is properly populated, so the problem is a wrong artifactId. It's spring-security-web, not org.springframework.security.web.



回答2:

You are using the wrong artifactId. Use this:

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-web</artifactId>
    <version>3.0.5.RELEASE</version>
</dependency>

And you don't need any custom repositories, you can find it in Maven Central.



回答3:

http://static.springsource.org/spring-security/site/petclinic-tutorial.html gives a wrong artificact Id where I copied the dependency from. Interestingly it works with version 3.0.3.RELEASE but not with 3.0.5.RELEASE.

Thanks for the hint Sean, I updated the answer.