|
| 1 | +Example Projects |
| 2 | +================ |
| 3 | + |
| 4 | +## Libraries |
| 5 | + |
| 6 | +Typical default case is a library, with `jar` [packaging](https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Packaging) (default packaging when not specified in `pom.xml`), |
| 7 | +`target/*.jar` output file built by `maven-jar-plugin`: |
| 8 | +- Maven dependencies of the library are pure symbolic references defined in `pom.xml` and version is just **preferred** |
| 9 | + (unless defined as `[x.y.z]` in `pom.xml`), |
| 10 | +- consumer of the library will get its dependencies as **transitive** dependencies of the library added and , |
| 11 | +- version of transitives are calculated by the built tool, based on consuming context: many aspects influence effective |
| 12 | + version, including `dependencyManagement` configuration and eventual conflicts between different transitives |
| 13 | + |
| 14 | +See Maven's [Introduction to Dependency Mechanism](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html) |
| 15 | +for more details. |
| 16 | + |
| 17 | +Also don't be confused: |
| 18 | +- a Maven `<dependency>` is a [CycloneDX `component`](https://cyclonedx.org/docs/1.6/json/#components): |
| 19 | + a [CycloneDX `dependency`](https://cyclonedx.org/docs/1.6/json/#dependencies) is a Maven's dependency tree node, |
| 20 | +- Maven's [dependency scope](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope) |
| 21 | + (`compile`, `provided`, `runtime`, `test`) is not a [CycloneDX scope](https://cyclonedx.org/docs/1.6/json/#components_items_scope) |
| 22 | + (`required`, `optional`, `excluded`), |
| 23 | +- Maven's [BOM POM](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#bill-of-materials-bom-poms) |
| 24 | +(used to import dependencyManagement `<dependencyManagement><scope>import</scope>`) is not a (CycloneDX) SBOM, |
| 25 | + |
| 26 | +## Java EE |
| 27 | + |
| 28 | +Java EE provide packaging archives formats where dependency components are copied: |
| 29 | + |
| 30 | +- `war` web archives, created by [`maven-war-plugin`](https://maven.apache.org/plugins/maven-war-plugin/) often through |
| 31 | + `war` packaging, with `*.jar` dependencies embedded in `WEB-INF/lib`, |
| 32 | +- `ejb` (with client), `rar`, `par`, `acr`... |
| 33 | +- `ear` enterprise archives, created by [`maven-ear-plugin`](https://maven.apache.org/plugins/maven-ear-plugin/), with |
| 34 | + flexible [EAR modules](https://maven.apache.org/plugins/maven-ear-plugin/modules.html) defining how libs are packaged. |
| 35 | + |
| 36 | +### Frontend |
| 37 | + |
| 38 | +https://github.com/eirslett/frontend-maven-plugin |
| 39 | + |
| 40 | +## Maven Assembly |
| 41 | + |
| 42 | +Flexible archive creation done by [`maven-assembly-plugin`](https://maven.apache.org/plugins/maven-assembly-plugin/), |
| 43 | +with optional [`dependencySet` configuration](https://maven.apache.org/plugins/maven-assembly-plugin/assembly.html#class_dependencySet). |
| 44 | + |
| 45 | +### Provisio |
| 46 | + |
| 47 | +[Provisio](https://github.com/jvanzyl/provisio) is another plugin trying to provide equivalent features. |
| 48 | + |
| 49 | +## Maven Shade |
| 50 | + |
| 51 | +[Maven Shade Plugin](https://maven.apache.org/plugins/maven-shade-plugin/) provides the capability to package the |
| 52 | +artifact in an uber-jar, including its dependencies and to shade - i.e. rename - the packages of some of the dependencies. |
| 53 | + |
| 54 | +It provides a very flexible way to [select content](https://maven.apache.org/plugins/maven-shade-plugin/examples/includes-excludes.html) |
| 55 | +from dependencies. |
| 56 | + |
| 57 | +## Executable Jars |
| 58 | + |
| 59 | +- [Spring Boot `repackage`](https://docs.spring.io/spring-boot/maven-plugin/packaging.html) |
| 60 | +- [Spring Boot OCI Images](https://docs.spring.io/spring-boot/maven-plugin/build-image.html) |
| 61 | +- [Uni-Jar](https://github.com/nsoft/uno-jar) |
| 62 | +- [App Assembler](https://www.mojohaus.org/appassembler/appassembler-maven-plugin/index.html) |
0 commit comments