Question

I have a Maven webapp that uses the maven-compiler-plugin . A few days ago I could compile and run the app just fine, however something happened and compilation now fails with the following error:

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

It has something to do with the compiler but I can't understand it. Here's my pom.xml (just the plugins):

    <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>

I have tried some solutions like this.

Était-ce utile?

La solution

As far as I know, ${endorsed.dir} is not a standard Maven property. Have you copied this example from somewhere without replacing ${endorsed.dir} with an actual value? Or did you have this value defined elsewhere in your pom.xmlbut it has been removed?

If this is the case, Maven would treat the field as blank and I can imagine the compiler would receive no argument for the -endorseddirs parameter.

Autres conseils

Java compiler is not able to locate property ${endorsed.dir} in you POM, Make sure it is defined in you POM. To check configuration of POM by mvn help:effective-pom, That will show actual POM after factoring all configuration.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top