我一直在试图解决这个问题几天,我已经看了遍历stackoverflow并且没有一个答案解决了我的问题.我正在尝试使用<version>我的Pom.xml.
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>maven.Test</groupId>
<artifactId>Hello</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<distributionManagement>
<repository>
<id>Artifactory</id>
<name>Artifactory-releases</name>
<url>${publish.location}</url>
</repository>
<snapshotRepository>
<id>Artifactory</id>
<name>Artifactory-snapshots</name>
<url>${publish.location}</url>
</snapshotRepository>
</distributionManagement>
</project>
Run Code Online (Sandbox Code Playgroud)
我目前正在使用Maven 3.3.3,我已经研究过SCM插件,但那些似乎没有用.我知道你可以通过将它们设置为变量来增加版本,但这对我的开发人员来说并不理想.使用命令运行构建时,mvn deploy我希望版本自动增加到1.0.1,依此类推.
编辑:
我尝试了maven发布,但遇到了一个可能在我身上的问题.对于发布插件,我需要对我的Pom.xml进行编辑吗?我跑了mvn release:prepare但遇到了这个错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3
.2:prepare (default-cli) on project Hello: Unable to check for local modificatio
ns
[ERROR] Provider message:
[ERROR] The svn command failed.
[ERROR] Command output:
[ERROR] 'svn' is not recognized as an internal or external command,
[ERROR] operable program or batch …Run Code Online (Sandbox Code Playgroud) 我正在使用一个子串,它将在第二个'之前给我一切.' 我之前使用过子串来获得第一个'之前的所有内容'.'
$id = $file.Substring(0, $File.LastIndexof('.'))
Run Code Online (Sandbox Code Playgroud)
它完美无缺.对于第二个子串,这是我迄今为止所拥有的
$netVerShort = $netVer.Substring(0, 2nd ('.'))
Run Code Online (Sandbox Code Playgroud)
但我确定这不对.我从$ netVer获得的值是2.0.5727,并且使用第二个子字符串我试图让它返回2.0