I am getting the above compilation error when trying to build a multi-modules Maven project in a Cygwin environment. The specific module that is breaking the build is a web service API that depends on the jaxb-api binding to perform the mapping of Java objects to XML elements. This is the specific error that is being generated:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ASRB2CServices: Compilation failure: Compilation failure: [ERROR] C:/IBM/RAD/workspace/XForm_Maven/XForm_Maven_20130610/ASRB2CServices/src/main/java/com/rccl/pcp/api/v1/pricetypes/package-info.java:[1,146] package annotations should be in file package-info.java
Here is the contents of the file that it's complaining about:
@javax.xml.bind.annotation.XmlSchema(namespace = "http://api.pcp.rccl.com/v1/priceTypes", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package com.rccl.pcp.api.v1.pricetypes;
I am using the 3.1 version of the maven java compiler plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<fork>true</fork>
<executable>${java.home}/bin/javac</executable>
</configuration>
</plugin>
And I'm using the 2.2.6 version of jaxb-api and 2.2.5 version of jaxb-impl:
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.6</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.5</version>
</dependency>
I am at a loss as to why I'm getting this error. I did some googling, and I saw mention of a possible compiler bug, but I believe I'm using the latest version of the maven compiler plugin. Any insights that anyone can provide would be greatly appreciated
I finally figured out the problem. Apparently, it was a compiler bug. I was using one of the compilers that came with the Java runtimes bundled with IBM RAD/WebSphere. This is set in my Maven settings.xml file:
<java.home>/Program Files (x86)/IBM/SDP/runtimes/base_v61/java</java.home>
When I changed it to a different JDK, it worked:
<java.home>/Program Files (x86)/Java/jdk1.6.0_34</java.home>
Thanks to those that took a look at my question.