Skip to content

Use the actual version of the Maven project for evaluating the skip parameter #418

@bvo42

Description

@bvo42

... and not the version set by the "projectVersion" configuration parameter.

Use Case

We don't want a project in the dependency track for every snapshot version of a Maven project, but only one that reflects the latest development status.

Solution approach

For this I configured the Mojo as follows:

<plugin>
	<groupId>io.github.pmckeown</groupId>
	<artifactId>dependency-track-maven-plugin</artifactId>
	<executions>
		<execution>
			<id>upload-snapshot-bom</id>
			<inherited>false</inherited>
			<phase>deploy</phase>
			<goals>
				<goal>upload-bom</goal>
			</goals>
			<configuration>
				<skip>releases</skip>
				<!-- We only want one project in Dependency Track that reflects the latest development status. -->
				<projectVersion>development</projectVersion>
			</configuration>
		</execution>
		<execution>
			<id>upload-release-bom</id>
			<inherited>false</inherited>
			<phase>deploy</phase>
			<goals>
				<goal>upload-bom</goal>
			</goals>
			<configuration>
				<skip>snapshots</skip>
			</configuration>
		</execution>
	</executions>
</plugin>

Problem

For the execution upload-snapshot-bom the Mojo uses the string development to check if the project is a snapshot or a release version. Since development corresponds to the format of a release version, the plugin is prevented from running because skip=releases is set :-(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions