【问题标题】:Maven webapp "javac: -endorseddirs requires an argument"Maven webapp“javac:-endorseddirs 需要一个参数”
【发布时间】:2012-08-27 22:46:24
【问题描述】:

我有一个使用 maven-compiler-plugin 的 Maven webapp。几天前我可以正常编译和运行应用程序,但是发生了一些事情,现在编译失败并出现以下错误:

[ERROR] Failure executing javac, but could not parse the error:
javac: -endorseddirs requires an argument
Usage: javac <options> <source files>

它与编译器有关,但我无法理解。这是我的 pom.xml(只是插件):

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <compilerArguments>
                    <endorseddirs>${endorsed.dir}</endorseddirs>
                </compilerArguments>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.1</version>
            <executions>

            </executions>
        </plugin>
    </plugins>

我尝试了一些解决方案,例如this。

【问题讨论】:

    标签: java maven maven-compiler-plugin


    【解决方案1】:

    据我所知,${endorsed.dir} 不是标准的 Maven 属性。您是否从某处复制了此示例,而没有将 ${endorsed.dir} 替换为实际值?或者您是否在 pom.xml 的其他地方定义了这个值,但它已被删除?

    如果是这种情况,Maven 会将字段视为空白,我可以想象编译器不会收到 -endorseddirs 参数的任何参数。

    【讨论】:

      【解决方案2】:

      Java 编译器无法在您的 POM 中找到属性 ${endorsed.dir},请确保它已在您的 POM 中定义。通过mvn help:effective-pom 检查 POM 的配置,这将在考虑所有配置后显示实际的 POM。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-06-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-11-08
        • 2012-06-23
        相关资源
        最近更新 更多