Maven has a convention over configuration philosophy: it has strict
expectations of how the project directories will be laid out, and if those
expectations are followed, it knows what to do, without need to add more
information in the POM. Sources go in src
, and they are split between main
and test
for sources that are only built for tests. Sources written in Java
go in a java
subdirectory. So, the Java class that was shown earlier could be
saved as Hello.java
, here:
| pom.xml
| src
| | main
| | java
| | Hello.java
| target
| proj-0.0.1-SNAPSHOT.jar
After running mvn clean package
again, what is now in the jar?
$ jar tf target/proj-0.0.1-SNAPSHOT.jar
META-INF/
META-INF/MANIFEST.MF
com/example/
com/example/proj/
com/example/proj/Hello.class
META-INF/maven/
META-INF/maven/com.example/
META-INF/maven/com.example/proj/
META-INF/maven/com.example/proj/pom.xml
META-INF/maven/com.example/proj/pom.properties
This is good progress. The class file is placed in the jar at its correct,
package-based path, even though the Java file was saved directly in
src/main/java
. That is convenient for such a small project. A larger project
with many classes would probably organize the source files into package-based
subdirectories of src/main/java
also.
But something is still missing from this jar. It does not contain any
pljava.ddr
file to tell PL/Java what to do when loading it.