Class PomFileGenerator
- All Implemented Interfaces:
Generator, ResourceProvider
A Generator (mainly) for POM files. In response to requests for
PomFile it generates a maven Model with basic information.
The group is set to the value of the property MvnProperties.GroupId
if it is defined. The artifact id is set to the property
MvnProperties.ArtifactId or the name of the project, if
MvnProperties.ArtifactId is not defined. The version is set to
the value of the property Project.Properties.Version.
This basic model is passed to adaptPom(Consumer) where it can be adapted.
as the project requires. Finally, the model is written to the
POM file.
In addition to the PomFile requests, this generator also handles
requests for MvnRepoDependency. This reflects that a project that
has a POM file is obviously intended to be released as a maven
artifact. Other projects in a multi-project build will therefore
eventually depend on the maven artifact "to be released".
-
Field Summary
FieldsFields inherited from class AbstractProvider
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAllow derived classes to post process the generated POM.Returns the destination directory.destination(Path destination) Sets the destination directory.destination(Supplier<Path> destination) Sets the destination directory.doProvide(ResourceRequest<T> requested) Invoked byAbstractProvider.provide(ResourceRequest)after checking if the invocation is allowed.POMs do not contain any information whether the library is intended to be used at runtime or at compile time.Methods inherited from class AbstractGenerator
cleanup, name, name, newResource, project, toStringMethods inherited from class AbstractProvider
provideMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ResourceProvider
provide
-
Field Details
-
GENERATED_BY
-
-
Constructor Details
-
PomFileGenerator
Instantiates a new library generator.- Parameters:
project- the project
-
-
Method Details
-
destination
Returns the destination directory. Defaults to sub directorypublications/mavenin the project's build directory (seeProject.buildDirectory()).- Returns:
- the destination
-
destination
Sets the destination directory. ThePathis resolved against the project's build directory (seeProject.buildDirectory()).- Parameters:
destination- the new destination- Returns:
- the jar generator
-
destination
Sets the destination directory.- Parameters:
destination- the new destination- Returns:
- the jar generator
-
runtimeLibrary
POMs do not contain any information whether the library is intended to be used at runtime or at compile time. This information is only needed when this generator responds to requests forMvnRepoDependency.- Returns:
- the pom file generator
-
doProvide
Description copied from class:AbstractProviderInvoked byAbstractProvider.provide(ResourceRequest)after checking if the invocation is allowed.- Specified by:
doProvidein classAbstractProvider- Type Parameters:
T- the generic type- Parameters:
requested- the requested- Returns:
- the stream
-
adaptPom
Allow derived classes to post process the generated POM.- Parameters:
adaptor- the adaptor- Returns:
- the pom file generator
-