Search in sources :

Example 1 with Configuration

use of com.qoomon.maven.extension.gitversioning.config.model.Configuration in project maven-git-versioning-extension by qoomon.

the class VersioningConfigurationProvider method get.

public VersioningConfiguration get() {
    if (configuration == null) {
        MavenSession session = SessionScopeUtil.get(sessionScope, MavenSession.class).get();
        List<VersionFormatDescription> branchVersionDescriptions = new LinkedList<>();
        List<VersionFormatDescription> tagVersionDescriptions = new LinkedList<>();
        File configFile = ExtensionUtil.getConfigFile(session.getRequest(), BuildProperties.projectArtifactId());
        if (configFile.exists()) {
            Configuration configurationModel = loadConfiguration(configFile);
            branchVersionDescriptions.addAll(configurationModel.branches);
            tagVersionDescriptions.addAll(configurationModel.tags);
        } else {
            logger.info("No configuration file found. Apply default configuration.");
        }
        branchVersionDescriptions.add(DEFAULT_BRANCH_VERSION_DESCRIPTION);
        configuration = new VersioningConfiguration(branchVersionDescriptions, tagVersionDescriptions);
    }
    return configuration;
}
Also used : MavenSession(org.apache.maven.execution.MavenSession) Configuration(com.qoomon.maven.extension.gitversioning.config.model.Configuration) VersionFormatDescription(com.qoomon.maven.extension.gitversioning.config.model.VersionFormatDescription) File(java.io.File) LinkedList(java.util.LinkedList)

Aggregations

Configuration (com.qoomon.maven.extension.gitversioning.config.model.Configuration)1 VersionFormatDescription (com.qoomon.maven.extension.gitversioning.config.model.VersionFormatDescription)1 File (java.io.File)1 LinkedList (java.util.LinkedList)1 MavenSession (org.apache.maven.execution.MavenSession)1