I have package-info.java in my package, Hibernate wants it for some features (programatic entity scanning).
However, mvn package
does not result in package-info.class
being in classes/
thus not in the artifact.
How can I force that happening?
mvn -v
Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
Java version: 1.6.0_26
Java home: /usr/lib/jvm/java-6-sun-1.6.0.26/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.35-30-generic" arch: "amd64" Family: "unix"
Creating a package-info file is fairly simple: we can create it manually or seek IDE help for generating the same. In IntelliJ IDEA, we can right-click on the package and select New-> package-info. java: Eclipse's New Java Package option allows us to generate a package-info.
package-info. java is a way to apply java annotations at the package level. In this case Jaxb is using package-level annotations to indicate the namespace, and to specify namespace qualification for attributes (source).
The package-info. java is a Java file that can be added to any Java source package. Its purpose is to provide a home for package level documentation and package level annotations.
A package is a namespace that organizes a set of related classes and interfaces. Conceptually you can think of packages as being similar to different folders on your computer. You might keep HTML pages in one folder, images in another, and scripts or applications in yet another.
Give -Xpkginfo:always
option to javac.
See the
javac
1.8 documentation
javac
17 documentation
The error was that the package-info.java must have any annotation with Retention=RUNTIME
to compile into a class. Otherwise, JDK 6 omits it.
I used @Deprecated
which is the only one in Java SE (and I didn't want to introduce an annotation just because of that).
@Deprecated
package cz.zizka.ondra.packageinfo.test
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With