23998

Maven Producing Empty JAR

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).

Answer1:

How about trying this with the latest version of maven compiler plugin, which is 2.3.2 after removing the <includes> <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.

Answer2:

If memory serves you don't need the includes. The sourceDirectory specification should be enough. Then run

mvn clean package

Recommend

  • How to include Maven dependencies in Manifest file
  • How to configure more than one output directories for maven war plugin?
  • Disable auto compilation of LESS
  • How to exclude a resource file in a Maven assembly?
  • How to enable Drag a Marker (Android Map Api v2) after a single Touch?
  • How do I fix “The program issued a command but the command length is incorrect.” error when calling
  • Error Processing Request: Mage registry key “_singleton/inchoo_notes/feed_updates” already exists
  • removing last 3 characters on a file (file extension)
  • Need code translation from VB to C#
  • PHP Listener Script for Paypal Webhooks
  • php script is parsing content from RTE (tt_news) but internal links are not appearing as speaking ur
  • KnockoutObservableArray with typed elements in TypeScript
  • How to get latest version of a artifact on Bintray using JSONP
  • C# fibonacci function returning errors
  • During installation of Django, why do I keep getting ImportError: No module named django?
  • How to get current document uri in XSLT?
  • Convert Type Decimal to Hex (string) in .NET 3.5
  • What is the purpose of TaskExecutor in spring?
  • Spring Cloud Microservice Architecture Confusion
  • error importing numpy
  • Very simple C++ DLL that can be called from .net
  • How can I send an e-mail from a vbs script
  • Cross-Platform Protobuf Serialization
  • Deserializing XML into class C#
  • Statically linking a C++ library to a C# process using CLI or any other way
  • Why is the timeout on a windows udp receive socket always 500ms longer than set by SO_RCVTIMEO?
  • Is there a mandatory requirement to switch app.yaml?
  • How to format a variable of double type
  • How to include full .NET prerequisite for Wix Burn installer
  • Buffer size for converting unsigned long to string
  • C# - Getting references of reference
  • Hits per day in Google Big Query
  • -fvisibility=hidden not passed by compiler for Debug builds
  • coudnt use logback because of log4j
  • How to get Windows thread pool to call class member function?
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • JaxB to read class hierarchy
  • costura.fody for a dll that references another dll
  • UserPrincipal.Current returns apppool on IIS
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize