Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
529 views
in Technique[技术] by (71.8m points)

Maven compiler plugin - send parameters to javac (classpath or cp)

Is it possible to send arguments to javac through maven compiler plugin?

I want to set three classpaths as a argument to javac but maven returns

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project wplex-frameworks: Compilation failure
[ERROR] javac: invalid flag: classpath=*:.
[ERROR] Usage: javac <options> <source files>

Code:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>${maven-compiler.version}</version>
    <configuration>
        <source>1.8</source>
        <target>1.8</target>
        <fork>true</fork>
        <executable>/usr/lib/jvm/java-8-openjdk-amd64/bin/javac</executable>
        <compilerArgs>
            <arg>classpath=*:.</arg>
            <arg>-verbose</arg>
            <arg>-Xlint:all,-options,-path</arg>
        </compilerArgs>
        <excludes>
            <exclude>x/y/z/**</exclude>
        </excludes> 
    </configuration>
</plugin>

I have tried so far classpath=:. , -classpath=:. , -classpath *:.

The other arguments are fine.

question from:https://stackoverflow.com/questions/65947846/maven-compiler-plugin-send-parameters-to-javac-classpath-or-cp

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...