无法执行./mvnw软件包&& java -jar target / gs-spring-boot-docker-0.1.0.jar

时间:2019-11-12 19:39:49

标签: java spring maven spring-boot

我的代码基于 this example,但是当我执行./mvnw软件包&& java -jar target / docker-demo-0.0.1.jar时,我收到了失败消息。 注意:当我将DockerDemoApplication.java作为Java应用程序运行时,它成功在端口9199上运行

非常感谢您的帮助。

  1. 这是我的pom.xml
lastErrorReportable
  1. 一个简单的应用程序类。

        <?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>
            <parent>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-parent</artifactId>
                <version>2.1.6.RELEASE</version>
                <relativePath/> <!-- lookup parent from repository -->
            </parent>
            <groupId>com.desh.docker</groupId>
            <artifactId>docker-demo</artifactId>
            <version>0.0.1-SNAPSHOT</version>
            <name>docker-demo</name>
            <description>Demo project for Spring Boot</description>
    
            <properties>
                <java.version>1.8</java.version>
            </properties>
    
            <dependencies>
    
                <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>
            </dependencies>
    
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>               
                    </plugin>
                </plugins>
            </build>
    
        </project>
    
  2. 正在执行mvnw软件包&& java -jar target / docker-demo-0.0.1.jar,我正在关注。

    package com.desh.docker.dockerdemo;    
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RestController;
    
    @SpringBootApplication
    @RestController
    public class DockerDemoApplication {
    
        @RequestMapping("/")
        public String home() {
            return "Hello Docker World";
        }
    
        public static void main(String[] args) {
            SpringApplication.run(DockerDemoApplication.class, args);
        }
    
    }
    
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building docker-demo 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ docker-demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ docker-demo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ docker-demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\learning\projects\docker-demo\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ docker-demo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ docker-demo ---
[INFO]
[INFO] --- maven-jar-plugin:3.1.2:jar (default-jar) @ docker-demo ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.651 s
[INFO] Finished at: 2019-11-13T00:27:54+05:30
[INFO] Final Memory: 24M/434M
[INFO] ------------------------------------------------------------------------   
  1. 我尝试通过清理.m2 \ repository \ org \ apache \ maven中的文件夹或添加commons-io-1.3.2.zip \ org \ apache \ commons \ io \ output \ DeferredFileOutputStream.class来尝试帮助

  2. application.properties:

     [ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.1.2:jar (default- 
          jar) on project docker-demo: Execution default-jar of goal org.apache.maven.plugins:maven-jar- 
          plugin:3.1.2:jar failed: A required class was missing while executing 
         org.apache.maven.plugins:maven-jar-plugin:3.1.2:jar: 
       org/apache/commons/io/output/DeferredFileOutputStream
        [ERROR] -----------------------------------------------------
        [ERROR] realm =    plugin>org.apache.maven.plugins:maven-jar-plugin:3.1.2
        [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
        [ERROR] urls[0] = file:/C:/Users/desh.deepak/.m2/repository/org/apache/maven/plugins/maven-jar-plugin/3.1.2/maven-jar-plugin-3.1.2.jar
        [ERROR] urls[1] = file:/C:/Users/desh.deepak/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
        [ERROR] urls[2] = file:/C:/Users/desh.deepak/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
        [ERROR] urls[3] = file:/C:/Users/desh.deepak/.m2/repository/org/sonatype/aether/aether-util/1.7/aether-util-1.7.jar
        [ERROR] urls[4] = file:/C:/Users/desh.deepak/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
        [ERROR] urls[5] = file:/C:/Users/desh.deepak/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.7.1/plexus-component-annotations-1.7.1.jar
        [ERROR] urls[6] = file:/C:/Users/desh.deepak/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
        [ERROR] urls[7] = file:/C:/Users/desh.deepak/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
        [ERROR] urls[8] = file:/C:/Users/desh.deepak/.m2/repository/org/apache/maven/shared/file-management/3.0.0/file-management-3.0.0.jar
        [ERROR] urls[9] = file:/C:/Users/desh.deepak/.m2/repository/org/apache/maven/shared/maven-shared-io/3.0.0/maven-shared-io-3.0.0.jar
        [ERROR] urls[10] = file:/C:/Users/desh.deepak/.m2/repository/org/apache/maven/maven-archiver/3.4.0/maven-archiver-3.4.0.jar
        [ERROR] urls[11] = file:/C:/Users/desh.deepak/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar
        [ERROR] urls[12] = file:/C:/Users/desh.deepak/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.2.1/maven-shared-utils-3.2.1.jar
        [ERROR] urls[13] = file:/C:/Users/desh.deepak/.m2/repository/org/codehaus/plexus/plexus-archiver/4.1.0/plexus-archiver-4.1.0.jar
        [ERROR] urls[14] = file:/C:/Users/desh.deepak/.m2/repository/org/codehaus/plexus/plexus-io/3.1.1/plexus-io-3.1.1.jar
        [ERROR] urls[15] = file:/C:/Users/desh.deepak/.m2/repository/org/apache/commons/commons-compress/1.18/commons-compress-1.18.jar
        [ERROR] urls[16] = file:/C:/Users/desh.deepak/.m2/repository/org/iq80/snappy/snappy/0.4/snappy-0.4.jar
        [ERROR] urls[17] = file:/C:/Users/desh.deepak/.m2/repository/org/tukaani/xz/1.8/xz-1.8.jar
        [ERROR] urls[18] = file:/C:/Users/desh.deepak/.m2/repository/org/codehaus/plexus/plexus-utils/3.2.0/plexus-utils-3.2.0.jar
        [ERROR] Number of foreign imports: 1
        [ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
        [ERROR]
        [ERROR] -----------------------------------------------------: org.apache.commons.io.output.DeferredFileOutputStream
        [ERROR] -> [Help 1]
        [ERROR]
        [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
        [ERROR] Re-run Maven using the -X switch to enable full debug logging.
        [ERROR]
        [ERROR] For more information about the errors and possible solutions, please read the following articles:
        [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

0 个答案:

没有答案