在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):bdemers/maven-external-version开源软件地址(OpenSource Url):https://github.com/bdemers/maven-external-version开源编程语言(OpenSource Language):Java 97.4%开源软件介绍(OpenSource Introduction):Maven External VersionRequires Maven 3.2.0 or later. (github is the temporary home.) What is this?The main use-case of this extension plugin is to allow the POM versions to be updated during a build and NOT require the pom.xml file to be modified (causing potential merge conflicts down the road, or untracked changes) When would I use this?Say, you have github-flow approach to branching, that is you create a lot of small feature branches, they get merged into 'master' then you release off of master. Currently if you want to build multiple SNAPSHOT branches in CI and and deploy them to a Maven repository, you need to update your POMs before you deploy. This will help you with that. For example if your Need to add real example here, when I'm more awake. Until then, look at this. Quick and Dirty ExampleIn your pom add: <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-external-version-plugin</artifactId>
<version>0.1.0-SNAPSHOT</version>
<extensions>true</extensions>
<configuration>
<strategy hint="sysprop"/>
</configuration>
</plugin>
To replaced the whole version you can run:
To add just a qualifier to the version:
Add a version qualifier to all non-master branches
Or how about a short git hash?
Configuration & parameters <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-external-version-plugin</artifactId>
<version>X.Y.Z</version>
<extensions>true</extensions>
<configuration>
<strategy hint="STRATEGY"/>
<generateTemporaryFile>true/false</generateTemporaryFile>
<deleteTemporaryFile>true/false</deleteTemporaryFile>
</configuration>
</plugin>
Strategy : fileThis strategy reads the first line of a given file to extract the version to use. Usage <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-external-version-plugin</artifactId>
<version>X.Y.Z</version>
<extensions>true</extensions>
<configuration>
<strategy hint="file">
<versionFilePath>SOME_FILE</versionFilePath>
</strategy>
</configuration>
</plugin>
Parameters
Strategy : scriptThis strategy allows to execute a given command ; the first line of stdout output will be used as version. Usage <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-external-version-plugin</artifactId>
<version>X.Y.Z</version>
<extensions>true</extensions>
<configuration>
<strategy hint="script">
<script>SOME_COMMAND</script>
</strategy>
</configuration>
</plugin>
Parameters
Strategy : syspropThis strategy uses 2 system properties to define the new project version:
Usage <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-external-version-plugin</artifactId>
<version>X.Y.Z</version>
<extensions>true</extensions>
<configuration>
<strategy hint="sysprop" />
</configuration>
</plugin>
TODO:
Other ThoughtsAn extension isn't exactly the most flexible way of adding this feature to Maven, but it seems to work (at least with simple cases) |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论