java - Maven build fails in Docker: "Failed to execute goal maven-resources-plugin:3.2.0:resources - Function not imple

I'm trying to containerise a Java Spring Boot application using Maven and Docker, but my build con

I'm trying to containerise a Java Spring Boot application using Maven and Docker, but my build consistently fails inside the Docker container at the maven-resources-plugin step with the error:

[ERROR] Failed to execute goal .apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources) on project my-app: Function not implemented -> [Help 1]

I am setting up this project on a new hosted server. I have manually installed Docker, Maven, and Java at the system root level.

Project setup

I have the following Dockerfile:

FROM maven:3.9.0-eclipse-temurin-19 AS MAVEN_BUILD
COPY pom.xml /build/
COPY src /build/src/
WORKDIR /build/
RUN mvn dependency:resolve
RUN mvn clean package -Pdocker

FROM eclipse-temurin:19
COPY --from=MAVEN_BUILD /build/target/my-app-1.0-SNAPSHOT.jar /app/
EXPOSE 8082
ENTRYPOINT ["java", "--add-opens", "java.base/java.time=ALL-UNNAMED", "-jar", "/app/my-app-1.0-SNAPSHOT.jar"]

pom.xml file:

<project xmlns=".0.0" xmlns:xsi=";
         xsi:schemaLocation=".0.0 .0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.4</version>
    </parent>

    <groupId>com.my.app</groupId>
    <artifactId>My-App-Service</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <properties>
        <mavenpiler.source>19</mavenpiler.source>
        <mavenpiler.target>19</mavenpiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <!-- Include other dependencies as necessary -->
    </dependencies>

    <profiles>
        <profile>
            <id>docker</id>
            <properties>
                <env>docker</env>
            </properties>
        </profile>
    </profiles>

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

What I have tried

  1. Verified it works locally:

    • Running mvn clean package outside Docker (on my machine) works fine.
    • Running the Maven project build outside Docker on the hosted server also works fine.
    • Building the Dockerized project locally also works without any issues.
  2. Checked for missing dependencies:

    • I tried adding mvn dependency:resolve before mvn clean package.

This is a new setup for me, and I'm trying to troubleshoot this issue with the resources available. Since I am moving the project from one server to another, I would prefer not to make changes to the Dockerfile, as it was working fine on the previous server.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744898615a4599844.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信