#!/bin/sh | |
# | |
# I'd expect the following to fail, but it works because javac will implicitly load A.java | |
# from src/main/java passed as -sourcepath. | |
# That wouldn't happen if javac was called with a dummy -sourcepath; sourcepath is not needed | |
# as Maven already computes the exact list of source files to compute. | |
# Proof by example: uncomment the `compilerArgs` and run `mvn clean compile` again | |
# | |
mkdir -p src/main/java/foo/bar | |
echo ' | |
<project | |
xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>test</groupId> | |
<artifactId>test</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
<build> | |
<plugins> | |
<plugin> | |
<artifactId>maven-compiler-plugin</artifactId> | |
<version>3.2</version> | |
<configuration> | |
<excludes> | |
<exclude>**/A.*</exclude> | |
</excludes> | |
<!-- Uncomment to workaround bug: --> | |
<!-- | |
<compilerArgs> | |
<arg>-sourcepath</arg> | |
<arg>:</arg> | |
</compilerArgs> | |
--> | |
</configuration> | |
</plugin> | |
</plugins> | |
</build> | |
</project> | |
' > pom.xml | |
echo ' | |
package foo.bar; | |
abstract class A { | |
} | |
' > src/main/java/foo/bar/A.java; | |
echo ' | |
package foo.bar; | |
class B extends A { | |
} | |
' > src/main/java/foo/bar/B.java; | |
mvn compile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment