Add the plugin to your pom:
<build> <plugins> <plugin> <groupId>de.hilling.maven.release</groupId> <artifactId>smart-release-plugin</artifactId> <version>4.0</version> </plugin> </plugins> </build>
To run the release, use mvn smart-release:prepare. This will execute the following steps:
mvn -pl $(cat modules-to-build.txt) clean deploy
git push && git push --tags
To create a bugfix release, follow these steps:
If you try to merge your changes from a bugfix branch into some other branch that is roughly based on master you will run into the problem that the release-info.json files cannot be merged. In fact they are not supposed to be merged:
At the moment you have to take care of this situation yourself. If you accidently merge the bugfix .release-info.json into your master branch however, the next release will just fail because the version numbers in the bugfix release are not valid for major releases. So you will be able to fix this accident manually.
See release-info for details.
It is possible to force the release of one or more specified modules, for example if the changes have not been picked up due to some issue. To do this, use the forceRelease parameter. For example:
mvn smart-release:prepare -DforceRelease=MyApp
In this case the MyApp module will be built, even if there where no changes found.
Currently, only public key authentication is supported. By default, the plugin reads the private key from ~/.ssh/id_rsa. If it’s required to use a private key file from another location, you have two opportunities to achieve this:
This is the preferred way. Firstly, add a server section to your Maven settings like this (see https://maven.apache.org/settings.html#Servers for further information):
<settings> <servers> <server> <id>my-server</id> <privateKey>/path/to/your/private_key</privateKey> <passphrase>optional_passphrase</passphrase> <!-- This is optional --> </server> </servers> </settings>
If your key is password protected, specify the password within element passphrase. Tip: do not confuse this with element password.
Secondly, specify the serverId in the plugin configuration
<plugin> ... <configuration> <serverId>my-server</serverId> </configuration> </plugin>
This is the insecure way to specify your custom private key. Add following properties to your plugin configuration:
<plugin> ... <configuration> <privateKey>/path/to/your/private_key</privateKey> <passphrase>optional_passphrase</passphrase> <!-- This is optional --> </configuration> </plugin>
Note: POM configuration has precedence over Maven settings.
Per default, the plugin uses ~/.ssh/known_hosts. You can override this with following property in your plugin configuration:
<plugin> ... <configuration> <knownHosts>/path/to/your/known_hosts</knownHosts> </configuration> </plugin>
Note: Maven settings related to known_hosts will not be considered by the plugin.
To build and run the tests, you need Java 8 or later and Maven 3 or later. Simply clone and run mvn install
Note that the tests run the plugin against a number of sample test projects, located in the test-projects folder. If adding new functionality, or fixing a bug, it is recommended that a sample project be set up so that the scenario can be tested end-to-end.
See also CONTRIBUTING.md for information on deploying to Nexus and releasing the plugin.