无法在Google Cloud上使用mvn复制文件以获取工件错误

时间:2018-10-06 22:23:46

标签: java maven google-cloud-platform bitnami

当我尝试在bitnami谷歌云映像上使用maven生成应用程序时遇到错误。当我将其部署到Windows时,该构建工作正常。你有什么想法吗?

在下图中,我删除了javax.faces以确认maven跟踪其依赖关系,但在此之后它仍然发出错误。

任何帮助将不胜感激。

image: maven tracks dependency but generates an error message

<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>Armentano</groupId>
  <artifactId>gp2pl</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <name>POC #1</name>

    <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
            <source>1.8</source>
            <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.7</version>
            <configuration>
            <encoding>UTF-8</encoding>
            </configuration>
        </plugin>
    </plugins>
    </build>

    <repositories>
    <repository>
        <id>jvnet-nexus-releases</id>
        <name>jvnet-nexus-releasees</name>
        <url>https://maven.java.net/content/repositories/releases</url>
    </repository>
    </repositories>

    <dependencies>  
        <!-- Java Server Faces -->
        <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
        </dependency>

        <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>javax.faces</artifactId>
        <version>2.2.10</version>
        </dependency>

        <!-- Hibernate -->
        <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.3.4.Final</version>
        </dependency>

        <!-- MySQL -->
        <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>8.0.12</version>
        </dependency>

    </dependencies>

</project>

1 个答案:

答案 0 :(得分:0)

您可以尝试两种方法来解决此问题。 1.-如果您不知道GCP如何重新组合,请按照步骤[1]中的GCP配置Maven。 2.-使用更高版本的“ org.apache.maven.plugins”,如下所示:

 <plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-compiler-plugin</artifactId>
   <version>3.8.0</version>
   <configuration>
     <source>1.8</source>
     <target>1.8</target>
   </configuration>
 </plugin>

或检查apache Maven的对象设置[2]

[1]https://cloud.google.com/appengine/docs/standard/java/tools/maven#setting_up_maven
[2]https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html