I have the following pom file:
<build> <defaultGoal>package</defaultGoal> <sourceDirectory>src/web</sourceDirectory> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <includes> <include>src/web/**/*.java</include> </includes> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <outputDirectory>lib</outputDirectory> </configuration> </plugin> </plugins> </build>
My source files are in the src/web/org/myCompany/ folder. When I run the pom file, I get a JAR generated with no class files. What is wrong with the way that I specified the source directories? I do not get any error messages, just an empty JAR (with some META-INF files).
On a sidenote, why does maven have both the
<sourceDirectory> tag and the
<include> tag on the maven compiler plugin? They seem to be redundant (except that the include tag allows multiple source directories).
How about trying this with the latest version of
maven compiler plugin, which is
2.3.2 after removing the
<configuration> section as indicated by others?
In any case, I think
<includes> would be a filter within the
<sourceDirectory> and thus cannot have
src/web specified again.
If memory serves you don't need the includes. The sourceDirectory specification should be enough. Then run
mvn clean package