簡體   English   中英

使用Maven為Openshift建立錯誤

[英]Error buildling with maven for openshift

這是我的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>

<groupId>myapp</groupId>
<artifactId>myapp</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>myapp</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.executable>${env.OPENSHIFT_WILDFLY_DIR}usr/lib/jvm/jdk1.8.0_05/bin/javac</maven.compiler.executable>
    <maven.compiler.fork>true</maven.compiler.fork>

    <spring.version>4.1.3.RELEASE</spring.version>
    <jstl.version>1.2</jstl.version>
</properties>

<dependencies>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.34</version>
    </dependency>
</dependencies>

<profiles>
    <profile>
        <!-- When built in OpenShift the 'openshift' profile will be used when invoking mvn. -->
        <!-- Use this profile for any OpenShift specific customization your app will need. -->
        <!-- By default that is to put the resulting archive into the 'deployments' folder. -->
        <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
        <id>openshift</id>
        <build>
            <finalName>myapp</finalName>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.3</version>
                    <configuration>
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                        <outputDirectory>deployments</outputDirectory>
                        <warName>ROOT</warName>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

當我使用mvn軟件包進行構建時

------------------------------------------------------------------------
Building myapp 1.0
------------------------------------------------------------------------

--- maven-resources-plugin:2.5:resources (default-resources) @ myapp ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
Copying 1 resource

--- maven-compiler-plugin:2.3.2:compile (default-compile) @ myapp ---
Compiling 1 source file to D:\git\myapp\target\classes
-------------------------------------------------------------
COMPILATION ERROR : 
-------------------------------------------------------------
Failure executing javac,  but could not parse the error:
The system cannot find the path specified.

1 error
-------------------------------------------------------------
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 0.711s
Finished at: Wed Dec 31 13:15:42 IST 2014
Final Memory: 6M/15M
------------------------------------------------------------------------
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project myapp: Compilation failure
Failure executing javac,  but could not parse the error:
The system cannot find the path specified.
-> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

可能是什么問題?

我的小組項目遇到了同樣的問題。 特別是,這行破壞了您的構建:

<maven.compiler.executable>${env.OPENSHIFT_WILDFLY_DIR}usr/lib/jvm/jdk1.8.0_05/bin/javac</maven.compiler.executable>

它指定javac編譯Java文件的路徑。 但是,上面的這一行指向固定路徑(並非在所有計算機上都相同)。 刪除它,您的本地版本將通過。 但是,我懷疑如果刪除該行,可能會在openshift端破壞某些內容。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM