All Projects → chonton → exists-maven-plugin

chonton / exists-maven-plugin

Licence: Apache-2.0 license
Check if artifact exists in remote maven repository

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to exists-maven-plugin

Sortpom
Maven plugin that helps the user sort pom.xml.
Stars: ✭ 185 (+374.36%)
Mutual labels:  maven-plugin
Docker Maven Plugin
INACTIVE: A maven plugin for Docker
Stars: ✭ 2,597 (+6558.97%)
Mutual labels:  maven-plugin
snyk-maven-plugin
Test and monitor your projects for vulnerabilities with Maven. This plugin is officially maintained by Snyk.
Stars: ✭ 64 (+64.1%)
Mutual labels:  maven-plugin
Headless Burp
Automate security tests using Burp Suite.
Stars: ✭ 192 (+392.31%)
Mutual labels:  maven-plugin
Gmavenplus
A rewrite of GMaven, a Maven plugin for Groovy
Stars: ✭ 217 (+456.41%)
Mutual labels:  maven-plugin
pgpverify-maven-plugin
Verify Open PGP / GPG signatures plugin
Stars: ✭ 42 (+7.69%)
Mutual labels:  maven-plugin
Protoc Jar Maven Plugin
Protocol Buffers protobuf maven plugin - based on protoc-jar multi-platform executable protoc JAR
Stars: ✭ 177 (+353.85%)
Mutual labels:  maven-plugin
dmn-check
A tool which performs static analyses on Decision Model Notation (DMN) files to detect bugs
Stars: ✭ 34 (-12.82%)
Mutual labels:  maven-plugin
Sculptor
Sculptor is a code generator that applies the concepts from Domain-Driven Design and Domain Specific Languages.
Stars: ✭ 220 (+464.1%)
Mutual labels:  maven-plugin
macosappbundler-maven-plugin
Maven plugin for creating a native macOS bundle containing all dependencies required by a Maven project
Stars: ✭ 35 (-10.26%)
Mutual labels:  maven-plugin
Versions Maven Plugin
Versions Maven Plugin
Stars: ✭ 199 (+410.26%)
Mutual labels:  maven-plugin
Javafx Maven Plugin
Maven plugin to run JavaFX 11+ applications
Stars: ✭ 213 (+446.15%)
Mutual labels:  maven-plugin
markdown-page-generator-plugin
Markdown to HTML Page Generator Maven Plugin
Stars: ✭ 48 (+23.08%)
Mutual labels:  maven-plugin
Formatter Maven Plugin
Formatter Maven Plugin
Stars: ✭ 187 (+379.49%)
Mutual labels:  maven-plugin
gatling-maven-plugin
Gatling Plugin for Maven
Stars: ✭ 30 (-23.08%)
Mutual labels:  maven-plugin
Maven Git Versioning Extension
This extension will virtually set project versions, based on current git branch or tag.
Stars: ✭ 178 (+356.41%)
Mutual labels:  maven-plugin
Modernizer Maven Plugin
Detect uses of legacy Java APIs
Stars: ✭ 234 (+500%)
Mutual labels:  maven-plugin
plexus-compiler
Plexus compiler a layer on top of compilers and used by maven-compiler-plugin
Stars: ✭ 24 (-38.46%)
Mutual labels:  maven-plugin
mvn-jlink
Maven plugin to provide way to work with jlink tool in maven projects
Stars: ✭ 34 (-12.82%)
Mutual labels:  maven-plugin
mvn scalafmt
Scalafmt plugin for maven
Stars: ✭ 14 (-64.1%)
Mutual labels:  maven-plugin

exists-maven-plugin

Check if a maven artifact exists. Designed around the use case of skipping deployment if the stable version already exists.

How This Plugin Determines if Builds are the "Same"

There are two strategies to determine if a maven artifacts are the "same" as what the project just built: version comparison, and checksum comparison. By default, this plugin uses version comparison. Version comparison simply checks if the group:artifact:version matches an artifact in the local or remote repository. This simple check will not catch the situation where the developer has failed to update the version in pom.xml.

Alternatively, when <cmpChecksum> is true, this plugin compares the checksum of the local or remote artifact with the just built artifact. Checksum comparison requires that the maven build be reproducible. Without specific configuration, maven builds are not reproducible. See Configuring for Reproducible Builds for details on making your build reproducible.

Goals

There are two goals: local checks if the just built artifact is already in the local repository; and remote checks if the just built artifact is already in the remote repository.

Mojo details at plugin info

Parameters

Every parameter can be set with a maven property exists.<parameter_name>. e.g. skip parameter can be set from command line -Dexists.skip=true.

In the following table p: indicates the default constituent properties are prefixed with project. and dm: indicates the default constituent properties are prefixed with project.distributionManagement. e.g. for artifact parameter, the full default is ${project.artifactId}-${project.version}.${project.packaging}

Parameter Default Description
artifact p: ${artifactId}-${version}.${packaging} The artifact within the project to query
cmpChecksum false Compare checksums of artifacts
failIfExists false Fail the build if the artifact already exists
failIfNotExists false Fail the build if the artifact does not exist
failIfNotMatch false Fail the build if the artifact exists and cmpChecksum is set and checksums do not match
lastSnapshotTime The property to set with the timestamp of the last snapshot install / deploy
project p: ${groupId}:${artifactId}:${packaging}:${version} The project within the repository to query
property ${maven.deploy.skip} or ${maven.install.skip} The property to receive the result of the query
repository dm: ${repository.url} For remote goal, the repository to query for artifacts
requireGoal Execute goal only if requireGoal value matches one of the maven command line goals
serverId dm: ${repository.id} For remote goal, the server ID to use for authentication and proxy settings
skip false Skip executing the plugin
skipIfSnapshot true Skip the query if the project ends with -SNAPSHOT
snapshotRepository dm: ${snapshotRepository.url} For remote goal, the repository to query for snapshot artifacts
snapshotServerId dm: ${snapshotRepository.id} For remote goal, the server ID to use for snapshot authentication and proxy settings
userProperty false If the property should be set as a user property, to be available in child projects

Requirements

  • Maven 3.5 or later
  • Java 11 or later

Typical Use

<build>
  <plugins>

    <plugin>
      <groupId>org.honton.chas</groupId>
      <artifactId>exists-maven-plugin</artifactId>
      <version>0.8.0</version>
      <executions>
        <execution>
          <goals>
            <goal>remote</goal>
          </goals>
        </execution>
      </executions>
    </plugin>

  </plugins>
</build>

Snapshot builds

When checking snapshot builds against a remote/local repository, the last deployed/installed snapshot of the correct version will be matched. Optionally, you can configure a property with the lastSnapshotTime parameter which will receive the build timestamp. If you need additional date math on the timestamp value, open a feature request with your use case.

Preventing failures of remote goal

Consider the scenario where there is an artifact that can only be deployed from a specific build server to a corporate repository with a specialized workflow that ensures various security and license policies. The exists-maven-plugin remote goal is also used to avoid duplicate deployments.

Running maven with the install phase will cause the exists-maven-plugin to execute the remote task. This might fail for various reasons; including the developer laptop is not connected to the internet, or the corporate repository is only available to specific build machines.

We could change the binding of the remote goal to the deploy phase. However, the maven-deploy-plugin's deploy goal will run before exists-maven-plugin's remote goal because "When multiple executions are given that match a particular phase, they are executed in the order specified in the POM, with inherited executions running first."

The solution is to leave the remote goal bound to the install phase and add a requireGoal configuration:

<configuration>
  <!-- run only if deploy goal is specified in maven command line -->
  <requireGoal>deploy</requireGoal>
</configuration>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].