java - 在 Azure DevOps 管道构建中出现此错误 "Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile"

标签 java maven azure-devops

我有一个 Maven 项目,它在我的本地机器 Eclipse 上成功运行。但是当我在 Azure DevOps 管道上运行相同的内容时,它显示“无法执行目标 org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile”

我已经在我的 pom.xml 中尝试了所有可能的配置。我几乎要放弃这个了。

UTF-8

    <maven.compiler.source>1.6</maven.compiler.source>
    <maven.compiler.target>1.6</maven.compiler.target>
    <java.version>1.8</java.version>

</properties>

<build>
    <sourceDirectory>src</sourceDirectory>
    <resources>
        <resource>
            <directory>src</directory>
            <excludes>
                <exclude>**/*.java</exclude>
            </excludes>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.14.1</version>
            <configuration>
                <!-- Suite testng xml file to consider for test execution -->
                <suiteXmlFiles>
                    <suiteXmlFile>testng.xml</suiteXmlFile>
                    <suiteXmlFile>testng.xml</suiteXmlFile>
                </suiteXmlFiles>
                <forkMode>never</forkMode>
            </configuration>
        </plugin>
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <fork>true</fork>
                <executable>C:\Program Files\Java\jdk1.8.0_181\bin\javac.exe</executable> 

            </configuration>
        </plugin>
    </plugins>

最佳答案

我刚刚将代理从 ubuntu 更改为 Windows。它解决了。

关于java - 在 Azure DevOps 管道构建中出现此错误 "Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57989003/

相关文章:

eclipse - 在部署/条件部署之前检查 war 文件

maven - 用同一个maven项目生成两个jar

bash - Azure DevOps bash脚本内联与路径输出不同

java - 将python斐波那契代码转换为java?

java - 应用程序可在Nougat +版本上运行,但在棉花糖和 Lollipop 上崩溃

java - 使用系统首选应用程序显示 zip 内的文件而不使用 java 解压缩?

java - Netbeans:包 com.mysql 不存在

java - 未命名的模块从两者读取包javax.websocket

azure - 更改 Azure Devops 发布管道中 yaml 文件的分支

azure - 部署后缺少环境变量