Package org.apache.maven.api
Interface Packaging
- All Superinterfaces:
ExtensibleEnum
Represents the packaging of a Maven project.
The Packaging
class defines the type of artifact that a Maven project produces during the build process.
The packaging type determines the structure of the project's output and how Maven will treat the resulting artifact.
Common packaging types include jar
, war
, pom
, maven-plugin
, ear
, and others.
These types influence various aspects of the build lifecycle, such as which plugins are executed and how dependencies are managed.
The Packaging
class is an immutable value object, ensuring that once a packaging type is defined, it cannot be changed.
Standard Packaging Types
jar
: Packages the project as a Java Archive (JAR) file.war
: Packages the project as a Web Application Archive (WAR) file.pom
: Indicates that the project does not produce a deployable artifact but is used for dependency management or as an aggregator.maven-plugin
: Packages the project as a Maven plugin.
Usage Example
Session session = ... // Obtain a Maven session
Packaging packaging = session.requirePackaging("jar");
System.out.println(packaging.getId()); // Outputs "jar"
- Since:
- 4.0.0
- See Also:
-
Method Details
-
id
The packaging id.- Specified by:
id
in interfaceExtensibleEnum
- Returns:
- the id
-
language
The language of this packaging. -
type
The type of main artifact produced by this packaging. -
plugins
Returns the binding to use specifically for this packaging keyed by lifecycle id. This will be used instead of the default packaging definition.
-