我正在尝试为Spring Boot应用程序创建docker映像,但出现此错误
在项目onlineStorePlatform上执行目标org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test(默认测试)失败:目标org.apache.maven.plugins:maven的执行默认测试-surefire-plugin:2.18.1:test失败:插件org.apache.maven.plugins:maven-surefire-plugin:2.18.1或其依赖项之一无法解析:以下工件无法解析:org。 apache.maven.surefire:maven-surefire-common:jar:2.18.1,org.apache.maven.surefire:surefire-api:jar:2.18.1,org.apache.maven:maven-core:jar:2.2。 1,org.apache.maven:maven-settings:jar:2.2.1,org.codehaus.plexus:plexus-interpolation:jar:1.11,org.apache.maven:maven-plugin-parameter-documenter:jar:2.2。 1,org.slf4j:slf4j-jdk14:jar:1.5.6,org.slf4j:slf4j-api:jar:1.5.6,org.slf4j:jcl-over-slf4j:jar:1.5.6,org.apache。 maven.reporting:maven-reporting-api:jar:3.0,org.apache.maven:maven-profile:jar:2.2.1,org.apache.maven:maven-model:jar:2.2.1,org.apache。 maven:maven-repository-metadata:jar:2.2.1,org.apache.mav en:maven-error-diagnostics:jar:2.2.1,org.apache.maven:maven-project:jar:2.2.1,org.apache.maven:maven-plugin-registry:jar:2.2.1,org。 apache.maven:maven-plugin-descriptor:jar:2.2.1,org.apache.maven:maven-artifact-manager:jar:2.2.1,backport-util-concurrent:backport-util-concurrent:jar:3.1, org.apache.maven:maven-monitor:jar:2.2.1,org.codehaus.plexus:plexus-utils:jar:1.5.15,org.apache.maven:maven-artifact:jar:2.2.1,org。 apache.maven.plugin-tools:maven-plugin-annotations:jar:3.3:在离线模式下无法访问中央(https://repo.maven.apache.org/maven2),而工件org.apache.maven.surefire:maven-surefire-common:jar:以前从未下载过2.18.1。 -> [帮助1]
POM.xml文件
<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>io.javabrains.spring</groupId>
<artifactId>onlineStorePlatform</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>onlineStorePlatform</name>
<!-- step #1: add the parent -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
</parent>
<!-- End of step #1 -->
<!-- step #2: create dependencies -->
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.19</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>7.0.0.jre8</version>
</dependency>
</dependencies>
<!-- step #3: change java version -->
<properties>
<java.versions>13.0.1</java.versions>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
<finalName>onlineStoreplatform</finalName>
</build>
</project>
最后是Dockerfile的内容
FROM openjdk:8
EXPOSE 8080
ADD target/onlineStoreplatform.jar onlineStoreplatform.jar
ENTRYPOINT ["java","-jar","/onlineStoreplatform.jar"]
任何帮助将不胜感激。
答案 0 :(得分:1)
您是否阅读了堆栈跟踪记录?
Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.apache.maven.surefire:maven-surefire-common:jar:2.18.1 has not been downloaded from it before
您的构建引擎似乎未连接到Internet。