我无法推送-jar:0.0.1-SNAPSHOT:找不到工件org.springframework:spring-test:jar:5.1.4.BUILD-SNAPSHOT

时间:2019-03-17 19:03:55

标签: java spring maven spring-boot pom.xml

我正在尝试推送代码,但出现此错误,并且我不了解要添加的内容或使用的版本错误。

这是我的错误:

jar:0.0.1-SNAPSHOT:在java-net-repo(https://maven.java.net/content/repositories/public/)中找不到工件org.springframework:spring-test:jar:5.1.4.BUILD-SNAPSHOT

这是我的pom:

<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.1.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.martinrico.berserker_v0</groupId>
<artifactId>berserker_v0</artifactId>
<version>4.1.1.RELEASE</version>
<name>berserker_v0</name>
<description>Demo project for Spring Boot</description>

<properties>
    <java.version>1.8</java.version>
    <jjwt.version>0.9.0</jjwt.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.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>runtime</scope>
    </dependency>

    <!-- For Working with Json Web Tokens (JWT) -->
    <dependency>
        <groupId>io.jsonwebtoken</groupId>
        <artifactId>jjwt</artifactId>
        <version>${jjwt.version}</version>
    </dependency>

    <!-- For Java 8 Date/Time Support -->
    <dependency>
        <groupId>com.fasterxml.jackson.datatype</groupId>
        <artifactId>jackson-datatype-jsr310</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-test</artifactId>
        <scope>test</scope>
    </dependency>

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

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>5.1.4.BUILD-SNAPSHOT</version>
        <scope>compile</scope>
    </dependency>

</dependencies>

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

任何帮助将不胜感激,在此先感谢!

1 个答案:

答案 0 :(得分:1)

这是当前的SNAPSHOT依赖关系,尚未发布到Maven Central:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-test</artifactId>
    <version>5.1.4.BUILD-SNAPSHOT</version>
    <scope>compile</scope>
</dependency>

如果确实需要此操作(请注意每次Maven运行期间的更改,因为这是快照的特征),则必须另外使用 Spring的Snapshot存储库

<repositories>
    <repository> 
        <id>repository.spring.snapshot</id> 
        <name>Spring Snapshot Repository</name> 
        <url>http://repo.spring.io/snapshot</url> 
    </repository>
</repositories>

也可以在repo path itself中查看相关性。