Why does the Maven Release plugin allow me to use the SNAPSHOT version in dependency management?

We have 1 parent pom. This uses dependencyManagement for version control for all dependencies of all artifacts used.

What is alarming is that SNAPSHOT versions can be determined depending on the control. Although, when maven is released, pom is allowed to release with the SNAPSHOT version depending on the control. What for?

If I point the child project to the released version of the parent company pom, and this child project uses the dependency defined in dependencyManagement, although this is the SNAPSHOT version, I cannot release the child project.

Why does Maven allow the SNAPSHOT version for the artifact defined in dependencyManagement to exit? And how can I configure the maven release plugin to fail if a version of SNAPSHOT is defined?

+5
source share
2 answers

What is alarming is that SNAPSHOT versions can be determined depending on the control. Although, when maven is released, pom is allowed to release with the SNAPSHOT version depending on the control. Why?

, maven-release-plugin SNAPSHOT dependencyManagement . , Jira , MRELEASE-91 MRELEASE-202, .

, : ?

, , , MRELEASE-202, ( , โ€‹โ€‹ ). , , . / ( , ) , .

+3

"" ( , ), : Maven Enforcer.

, smartics ( ), (NoSnapshotDependenciesInDependencyManagementRule), .

POM:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-enforcer-plugin</artifactId>
  <version>1.4.1</version>
  <executions>
    <execution>
      <id>enforce-project-rules</id>
      <phase>test</phase>
      <goals>
        <goal>enforce</goal>
      </goals>
      <configuration>
        <rules>
          <NoSnapshotDependenciesInDependencyManagementRule
            implementation="de.smartics.maven.enforcer.rule.NoSnapshotsInDependencyManagementRule">
            <onlyWhenRelease>true</onlyWhenRelease>
            <checkOnlyResolvedDependencies>false</checkOnlyResolvedDependencies>
          </NoSnapshotDependenciesInDependencyManagementRule>
        </rules>
      </configuration>
    </execution>
  </executions>
  <dependencies>
    <dependency>
      <groupId>de.smartics.rules</groupId>
      <artifactId>smartics-enforcer-rules</artifactId>
      <version>1.0.2</version>
    </dependency>
  </dependencies>
</plugin>
0

All Articles