Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
534 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 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...