gpt4 book ai didi

java - 使用 Maven for openshift 构建时出错

转载 作者:太空宇宙 更新时间:2023-11-04 06:18:45 25 4
gpt4 key购买 nike

这是我的 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 方面的某些内容。

关于java - 使用 Maven for openshift 构建时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27718040/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com