Questions tagged [maven-compiler-plugin]

The Maven Compiler Plugin is used to compile the sources of your project. The default compiler is javac and is used to compile Java sources.

The Maven Compiler Plugin is used to compile the sources of your project.

The plugin always has a binding to the compile phase to compile application sources and to the test-compile phase to compile test sources.

Check the official usage page for a first look at this plugin.

More Info

293 questions
8
votes
3 answers

Excluding package with maven-compiler-plugin works for one package but doesn't work for another

My project has the following package structure: src/ com.my.app.school.course -Course.java ... com.my.app.school.course.free -CourseFree.java I use Maven to build the project, in my pom.xml, I defined maven-compiler-plugin to…
Leem.fin
  • 40,781
  • 83
  • 202
  • 354
7
votes
1 answer

Maven 3: How to exclude generated sources from Xlint check?

We only allow java source code without Xlint errors. However, when sources are generated by third party tools, this is not practical. Examples of generated sources in our use-case are: JFlex, JavaCC, JAXB and annotation processors. So the question…
rmuller
  • 12,062
  • 4
  • 64
  • 92
7
votes
3 answers

How can I configure Maven to use JDK6 by default, but JDK7 as needed

I have both JDK 1.6 and 1.7 installed on my system (Linux, under the /opt directory). I've added the bin directory for JDK 1.6 in my path, so that's the version of Java used by default. I'm working on a project that requires JDK 1.7 and some that…
ataulm
  • 15,195
  • 7
  • 50
  • 92
7
votes
1 answer

Error when using javac: "javac: invalid flag: -s"

I am trying to specify another version of JDK in maven-compiler-plugin. When -target and -source parameters are set to 1.5, everything is ok. But when i try to use 1.6 JDK, maven reports an error. Has anyone faced this problem? Error: Failure…
johnny-b-goode
  • 3,792
  • 12
  • 45
  • 68
6
votes
2 answers

Does maven-compiler-plugin consider dependencies when checking for stale sources?

Ant's depend task allows one to recompile Java source-code if any of its dependencies (referenced classes, not module dependencies) have been modified. I took a quick look at org.apache.maven.plugin.CompilerMojo and…
Gili
  • 86,244
  • 97
  • 390
  • 689
6
votes
3 answers

What is "" element on "" for the "maven-compiler-plugin" in a JavaFX app

I used the org.openjfx:javafx-archetype-simple Maven archetype to start my first JavaFX project. The resulting POM:
Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
6
votes
1 answer

How to pass additional classpath dependencies to testCompile phase in maven

I want to compile test files using some external jar dependencies which will not be present in pom.xml's dependency tag. Is there any way through configuration. Something like this- maven-compiler-plugin
Disha
  • 822
  • 1
  • 10
  • 39
6
votes
2 answers

Eclipse 4.3.2 with Java 8 patches doesn't recognize source level 1.8

I'm using Eclipse 4.3.2 with the patches for Java 8 from, along with m2e and Subclipse, completely updated to the latest versions of everything. I went into the Maven POMs for our project and changed the maven-compiler-plugin…
Garret Wilson
  • 18,219
  • 30
  • 144
  • 272
6
votes
1 answer

Arguments for eclipse compiler in Maven

In the Eclipse Compiler for Java standalone, I am able to log in XML the compilation info via a command-line atribute, as in this stub: java -jar ecj-4.3.2.jar -log compile.xml However, when I use maven-compiler-plugin with…
Diogo
  • 115
  • 7
6
votes
4 answers

How do I pass javac multiple command-line arguments, some of which include colon, without breaking Maven release plugin?

I want to make my Maven build fail when I forget to declare serialVersionUIDs in a Serializable class. With javac, that's easy: $ javac -Xlint:serial -Werror Source.java Directly translating that to Maven doesn't work:
gustafc
  • 28,465
  • 7
  • 73
  • 99
5
votes
3 answers

Maven compiler plugin does not see Lombok's annotations

in my application I have 3 modules like this: permissions (parent pom) |---permission-api (just api, without main spring class) |---permission-service (spring boot app) In parent pom in main module I have pom which contains:
MrFisherman
  • 720
  • 1
  • 7
  • 27
5
votes
3 answers

Why maven compilation doesn't work with "pom" packaging type

I don't know why my maven build doesn't generate target/classes in current pom setting, the packaging type must be "pom" in my case, please advise what is wrong... Thanks!
Even
  • 287
  • 2
  • 8
  • 21
5
votes
2 answers

Maven compiler error - invalid flag -- release

I am getting a maven compiler error when compiling with JDK 1.8 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project DUMMY : Fatal error compiling: invalid flag: --release -> [Help 1] Here…
ha9u63a7
  • 6,233
  • 16
  • 73
  • 108
5
votes
2 answers

Java 11 : Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile failed.: NullPointerException

I am upgrading my project from java 8 to java 11. I'm able to build and deploy it with java11, spring 5 dependencies but when I am adding module-info.java into my project I am getting below error while build : [ERROR] Failed to execute goal…
Pukhraj soni
  • 1,832
  • 2
  • 17
  • 11
5
votes
0 answers

Java 9 Module dependecy in Maven pom.xml

My project needs access to internal JDK classes, specifically internal JavaFX classes. This is no problem in Eclipse since I can add the Java 9 module I need to the Build Path. The problem occurs during the Maven build. I get errors like class file…
1 2
3
19 20