使用Maven打包并安装在项目上时出错

时间:2019-03-08 20:14:34

标签: java windows maven maven-3

当我尝试在项目中使用Maven时,出现跟随错误:

E:\path\to\project>mvn clean install
---------------------------------------------------
constituent[0]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../conf/logging/
constituent[1]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/animal-sniffer-annotations-1.14.jar
constituent[2]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/aopalliance-1.0.jar
constituent[3]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/cdi-api-1.0.jar
constituent[4]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/checker-compat-qual-2.0.0.jar
constituent[5]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/commons-cli-1.4.jar
constituent[6]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/commons-io-2.5.jar
constituent[7]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/commons-lang3-3.8.1.jar
constituent[8]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/error_prone_annotations-2.1.3.jar
constituent[9]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/guava-25.1-android.jar
constituent[10]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/guice-4.2.1-no_aop.jar
constituent[11]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/j2objc-annotations-1.1.jar
constituent[12]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/jansi-1.17.1.jar
constituent[13]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/javax.inject-1.jar
constituent[14]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/jcl-over-slf4j-1.7.25.jar
constituent[15]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/jsr250-api-1.0.jar
constituent[16]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/jsr305-3.0.2.jar
constituent[17]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-artifact-3.6.0.jar
constituent[18]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-builder-support-3.6.0.jar
constituent[19]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-compat-3.6.0.jar
constituent[20]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-core-3.6.0.jar
constituent[21]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-embedder-3.6.0.jar
constituent[22]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-model-3.6.0.jar
constituent[23]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-model-builder-3.6.0.jar
constituent[24]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-plugin-api-3.6.0.jar
constituent[25]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-repository-metadata-3.6.0.jar
constituent[26]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-resolver-api-1.3.1.jar
constituent[27]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-resolver-connector-basic-1.3.1.jar
constituent[28]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-resolver-impl-1.3.1.jar
constituent[29]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-resolver-provider-3.6.0.jar
constituent[30]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-resolver-spi-1.3.1.jar
constituent[31]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-resolver-transport-wagon-1.3.1.jar
constituent[32]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-resolver-util-1.3.1.jar
constituent[33]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-settings-3.6.0.jar
constituent[34]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-settings-builder-3.6.0.jar
constituent[35]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-shared-utils-3.2.1.jar
constituent[36]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/maven-slf4j-provider-3.6.0.jar
constituent[37]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/org.eclipse.sisu.inject-0.3.3.jar
constituent[38]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/org.eclipse.sisu.plexus-0.3.3.jar
constituent[39]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/plexus-cipher-1.7.jar
constituent[40]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/plexus-component-annotations-1.7.1.jar
constituent[41]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/plexus-interpolation-1.25.jar
constituent[42]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/plexus-sec-dispatcher-1.4.jar
constituent[43]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/plexus-utils-3.1.0.jar
constituent[44]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/slf4j-api-1.7.25.jar
constituent[45]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/wagon-file-3.2.0.jar
constituent[46]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/wagon-http-3.2.0-shaded.jar
constituent[47]: file:/E:/Entwicklung/Programme/apache-maven-3.6.0/bin/../lib/wagon-provider-api-3.2.0.jar
---------------------------------------------------
Exception in thread "main" java.lang.StackOverflowError
        at java.io.InputStream.<init>(InputStream.java:45)
        at java.io.FileInputStream.<init>(FileInputStream.java:123)
        at org.sonatype.plexus.components.sec.dispatcher.SecUtil.toStream(SecUtil.java:100)
        at org.sonatype.plexus.components.sec.dispatcher.SecUtil.read(SecUtil.java:56)

我已经测试了Maven 3.6.0和3.3.9。它与项目无关;每个Maven项目都会给出相同的例外。

该项目有一个带有两个模块的父POM,一个是Angular项目,另一个是Spring Boot项目。

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>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <groupId>de.business.customer</groupId>
    <artifactId>product-root</artifactId>
    <version>1.0.0-beta.9</version>
    <packaging>pom</packaging>

    <name>Product Parent</name>
    <description>Parent project for Angular and Spring.</description>

    <modules>
        <module>angular-gui</module>
        <module>spring-gui-backend</module>
    </modules>

    <properties>
        <project.version>1.0.0-beta.9</project.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.build.finalName>product</project.build.finalName>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <java.version>1.8</java.version>
        <spring-cloud.version>Greenwich.M3</spring-cloud.version>
        <keycloak.version>4.6.0.Final</keycloak.version>
        <joda-time.version>2.10</joda-time.version>
        <hibernate.version>5.3.6.Final</hibernate.version>
        <postgres.version>42.2.5</postgres.version>
        <springfox.version>2.9.2</springfox.version>

        <docker.repository>https://link.to.hub.de</docker.repository>
        <docker.folder>docker-folder</docker.folder>
    </properties>

</project>

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>

    <parent>
        <groupId>de.business.customer</groupId>
        <artifactId>product-root</artifactId>
        <version>1.0.0-beta.9</version>
    </parent>

    <artifactId>spring-gui-backend</artifactId>
    <version>1.0.0-beta.9</version>
    <packaging>jar</packaging>

    <name>spring-gui</name>
    <description>Rest API for GUI.</description>

    <repositories>
        <repository>
            <id>repository.springframework.maven.milestone</id>
            <name>Spring Framework Maven Milestone Repository</name>
            <url>http://repo.spring.io/milestone</url>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>spring-milestones</id>
            <url>https://repo.spring.io/milestone</url>
        </pluginRepository>
    </pluginRepositories>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.keycloak.bom</groupId>
                <artifactId>keycloak-adapter-bom</artifactId>
                <version>${keycloak.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <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-starter-data-mongodb</artifactId>
        </dependency>
        <!--<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>-->
        <!--<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-zuul</artifactId>
        </dependency>-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </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-devtools</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>

        <!--  Postgres -->
        <!--<dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>${postgres.version}</version>
        </dependency>-->

        <!--  Keycloak -->
        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-spring-security-adapter</artifactId>
        </dependency>

        <!--  Lombok -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>

        <!--  Joda Time -->
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>${joda-time.version}</version>
        </dependency>

        <!--  Hibernate -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.version}</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate.version}</version>
        </dependency>

        <!-- Jackson -->
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-joda</artifactId>
            <version>2.9.7</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.9.7</version>
        </dependency>

        <!-- Springfox Swagger -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${springfox.version}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>${springfox.version}</version>
        </dependency>

        <!-- Google Guava -->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>27.0-jre</version>
        </dependency>

        <!-- OpenCSV -->
        <dependency>
            <groupId>com.opencsv</groupId>
            <artifactId>opencsv</artifactId>
            <version>4.1</version>
        </dependency>

    </dependencies>

    <build>
        <finalName>${project.build.finalName}</finalName>

        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>dockerfile-maven-plugin</artifactId>
                <version>1.4.9</version>
                <executions>
                    <execution>
                        <id>default</id>
                        <goals>
                            <!--<goal>tag</goal>-->
                            <goal>build</goal>
                            <goal>push</goal>
                        </goals>
                        <configuration>
                            <tag>${project.version}</tag>
                        </configuration>
                    </execution>
                    <execution>
                        <id>default-2</id>
                        <goals>
                            <goal>tag</goal>
                            <!--<goal>build</goal>-->
                            <goal>push</goal>
                        </goals>
                        <configuration>
                            <tag>latest</tag>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <repository>${docker.folder}/backend</repository>
                    <buildArgs>
                        <JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
                    </buildArgs>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

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>

  <parent>
    <groupId>de.business.customer</groupId>
    <artifactId>product-root</artifactId>
    <version>1.0.0-beta.9</version>
  </parent>

  <artifactId>angular-gui</artifactId>
  <packaging>pom</packaging>

  <name>angular-gui</name>
  <description>Angular Application UI.</description>

  <build>
    <plugins>
      <plugin>
        <groupId>com.github.eirslett</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <version>1.6</version>
        <executions>
          <execution>
            <id>install node and npm</id>
            <goals>
              <goal>install-node-and-npm</goal>
            </goals>
          </execution>
          <execution>
            <id>npm install</id>
            <goals>
              <goal>npm</goal>
            </goals>
            <configuration>
              <arguments>install</arguments>
            </configuration>
          </execution>
          <execution>
            <id>npm build</id>
            <goals>
              <goal>npm</goal>
            </goals>
            <configuration>
              <arguments>run build</arguments>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <nodeVersion>v11.4.0</nodeVersion>
          <npmVersion>6.5.0</npmVersion>
          <installDirectory>target</installDirectory>
        </configuration>
      </plugin>

      <plugin>
        <groupId>com.spotify</groupId>
        <artifactId>dockerfile-maven-plugin</artifactId>
        <version>1.4.9</version>
        <executions>
          <execution>
            <id>default</id>
            <goals>
              <!--<goal>tag</goal>-->
              <goal>build</goal>
              <goal>push</goal>
            </goals>
            <configuration>
              <tag>${project.version}</tag>
            </configuration>
          </execution>
          <execution>
            <id>default-2</id>
            <goals>
              <goal>tag</goal>
              <!--<goal>build</goal>-->
              <goal>push</goal>
            </goals>
            <configuration>
              <tag>latest</tag>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <repository>${docker.folder}/frontend</repository>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>${java.version}</source>
          <target>${java.version}</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

有人有主意吗?

1 个答案:

答案 0 :(得分:0)

好的, settings-security.xml 中存在路径错误。