Class MvnPublishingDestination
java.lang.Object
org.jdrupes.builder.mvnrepo.MvnPublishingDestination
- Direct Known Subclasses:
MvnDeployDestination, PortalPublisherDestination
The base class for all Maven publishing destinations. It provides common functionality for managing a destination's accepted version types (SNAPSHOT, RELEASE) and for managing repository credentials.
Credentials for the destination are resolved using the following order of precedence:
- Explicitly set credentials: Values provided via the
credentials(java.lang.String,java.lang.String)method take the highest priority. - Build context properties: If no explicit credentials are set, the
publisher looks for
mvnrepo.userandmvnrepo.passwordwithin theBuildContext. - Maven
settings.xml: If an ID is configured for the destination, the publisher searches theserverssection of the Mavensettings.xmlfor a server matching that ID. - Fallback: If no credentials are found in any of the above sources, empty strings are used, which typically results in an anonymous upload attempt.
-
Constructor Summary
ConstructorsConstructorDescriptionMvnPublishingDestination(MvnVersionType... publicationTypes) Initializes a new Maven publishing destination. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccepts(MvnVersionType type) Checks if the given publication type is accepted.credentials(String user, String pass) Sets the Maven repository credentials.id()Returns the id.Sets the id.protected StringrepositoryPassword(BuildContext context) Returns the repository password set bycredentials(java.lang.String,java.lang.String)or a fallback.protected StringrepositoryUser(BuildContext context) Returns the repository user set bycredentials(java.lang.String,java.lang.String)or a fallback.booleanReturns if this destination requires checksum artifacts to be passed topublish(org.jdrupes.builder.api.BuildContext,org.jdrupes.builder.mvnrepo.MvnPublisher,org.eclipse.aether.artifact.Artifact,java.util.List<org.eclipse.aether.artifact.Artifact>).
-
Constructor Details
-
MvnPublishingDestination
Initializes a new Maven publishing destination.- Parameters:
publicationTypes- the accepted publication types
-
-
Method Details
-
accepts
Checks if the given publication type is accepted.- Parameters:
type- the type- Returns:
- true, if successful
-
requiresChecksumArtifacts
Returns if this destination requires checksum artifacts to be passed topublish(org.jdrupes.builder.api.BuildContext,org.jdrupes.builder.mvnrepo.MvnPublisher,org.eclipse.aether.artifact.Artifact,java.util.List<org.eclipse.aether.artifact.Artifact>).- Returns:
- true, if successful
-
id
Sets the id.- Parameters:
id- the new id- Returns:
- this destination
-
id
-
credentials
Sets the Maven repository credentials.- Parameters:
user- the user namepass- the password- Returns:
- this destination
-
repositoryUser
Returns the repository user set by
credentials(java.lang.String,java.lang.String)or a fallback.The fallback order is:
-
Look for properties
mvnrepo.userandmvnrepo.passwordin the properties provided by theBuildContext. -
If an id is set, look for the user and password in the
serverssection with this id in the Mavensettings.xml.
- Parameters:
context- the context- Returns:
- the user
-
-
repositoryPassword
Returns the repository password set bycredentials(java.lang.String,java.lang.String)or a fallback. SeerepositoryUser(org.jdrupes.builder.api.BuildContext)for the fallback logic.- Parameters:
context- the context- Returns:
- the password
-