【问题标题】:I have some problems with 'pom.xml' spring-boot我对'pom.xml' spring-boot 有一些问题
【发布时间】:2020-02-11 04:38:37
【问题描述】:

就像我的标题一样,我的 spring-boot 项目有一些问题。

我的错误信息:

Project build error: Non-resolvable parent POM for com.ta:TestAutomation:0.0.1-SNAPSHOT:
Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.0.4.RELEASE from http://repo.spring.io/plugins-release/ was cached in the local repository, 
resolution will not be reattempted until the update interval of Spring Plugins has elapsed or updates are forced. 
Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.0.4.RELEASE from/to Spring Plugins (http://repo.spring.io/plugins-release/): 
Access denied to http://repo.spring.io/plugins-release/org/springframework/boot/spring-boot-starter-parent/2.0.4.RELEASE/spring-boot-starter-parent-2.0.4.RELEASE.pom. 
Error code 403, Forbidden and 'parent.relativePath' points at no local POM

还有我的 pom.xml:

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

    <groupId>com.ta</groupId>
    <artifactId>TestAutomation</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>TestAutomation</name>
    <description>Test-automation project by BAEK SEUNGJIN</description>

    <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>
        <tiles.version>3.0.7</tiles.version>
    </properties>

    <repositories>
        <repository>
            <id>Spring Plugins</id>
            <url>http://repo.spring.io/plugins-release/</url>
        </repository>
    </repositories>

    <dependencies>


        <!-- spring base -->
        <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.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>


        <!-- Tiles -->
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-jsp</artifactId>
            <version>${tiles.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-extras</artifactId>
            <version>${tiles.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.velocity</groupId>
                    <artifactId>velocity</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>jboss</groupId>
                    <artifactId>javassist</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- jstl, jasper -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
        </dependency>


        <!-- mybatis - jdbc - oracle -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis-spring</artifactId>
            <version>1.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
        </dependency>

        <!-- log4jdbc -->
        <dependency>
            <groupId>org.bgee.log4jdbc-log4j2</groupId>
            <artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
            <version>1.16</version>
        </dependency>

        <!-- selenium -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
        </dependency>

        <!-- guava -->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>27.1-jre</version>
        </dependency>

        <!-- Quartz scheduler -->
        <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz</artifactId>
        </dependency>

        <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz-jobs</artifactId>
        </dependency>    
    </dependencies>

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

</project>

我无法理解...这些错误发生...只是最近发生的。

去年没有任何问题。

这个项目正在真实服务器上运行项目。我必须做一些更新,但因为这个我不能做。

有人知道解决办法吗?谢谢。

【问题讨论】:

  • 看起来像相对路径问题。
  • 如果有的话,你应该把父 pom.xml 路径放在 &lt;relativePath&gt;...&lt;/relativePath&gt; 节点中。例如:&lt;relativePath&gt;../parent/pom.xml&lt;/relativePath&gt;。如果没有本地 pom,请从您的 pom.xml 中省略该节点
  • 简单的问题是maven存储库同时只能通过https而不是http获取详细信息blog.sonatype.com/central-repository-moving-to-https这对spring repos也有效......除了那个spring boot等也可用在 Maven 中心内。

标签: spring-boot maven pom.xml


【解决方案1】:

看起来像防火墙问题。该文件在那里,Spring maven repos 没有理由拒绝您访问它们,除非您可能由于某种原因被列入黑名单。

首先检查您尝试运行构建的机器是否已连接到互联网,以及是否有防火墙阻止进出它的流量。

这很可能是您的问题。

【讨论】:

  • 感谢您的回答。但问题是......我可以在我的 chrome 浏览器上连接“repo.spring.io/......”。我想如果有防火墙或互联网连接问题,如你所说,我可能无法在我的网络浏览器上连接。
  • 我发现了问题!这是java版本问题。我使用 oracle 不是免费的 java 版本(241)。我改的版本太低了,所以问题解决了。
  • @BAEKSEUNGJIN 很高兴听到。最好迁移到 OpenJDK,Oracle 版本的许可证问题。
猜你喜欢
  • 2020-09-23
  • 2018-04-19
  • 2019-02-27
  • 1970-01-01
  • 1970-01-01
  • 2019-05-27
  • 2017-04-03
  • 2020-07-17
  • 1970-01-01
相关资源
最近更新 更多