当前位置: 首页 > 知识库问答 >
问题:

如何使用Git设置Maven release插件?

上官和韵
2023-03-14

在过去的几天里,我尝试为Git版本配置Maven发布插件。我已经为它设置了一个测试项目,我尝试了很多配置,以至于我不知道如何将它们全部显示给您...

在任何情况下,Maven Release插件都只使用当前签出的分支。如果我在主分支上启动发布插件,它会在上面创建标签,但是如果我在开发分支上,它会在那里创建所有东西。

我的实际pom是这样的:

<project>
...
<scm>
    <connection>scm:git:file://D:\Dev\gitremotetest\testpp</connection>
    <developerConnection>scm:git:file://D:\Dev\gitremotetest\testpp</developerConnection>
    <tag>HEAD</tag>
</scm>
...
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.5.3</version>
            <dependencies>
                <dependency>
                    <groupId>org.apache.maven.scm</groupId>
                    <artifactId>maven-scm-provider-gitexe</artifactId>
                    <version>1.9.5</version>
                </dependency>
            </dependencies>
            <configuration>
                <branchName>develop</branchName>
                <pushChanges>false</pushChanges>
                <localCheckout>true</localCheckout>
            </configuration>
        </plugin>
    </plugins>
</build>
...
</project>

我搜索了很多网站,找不到使用Git的Releasplugin的完整配置。结果应该是,开发分支是预发布版本0.0.1-SNAPSHOT和发布后版本0.0.2-SNAPSHOTmaster分支应包含预发布version0.0.0和发布后版本0.0.1

这是详细的Maven输出:

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: D:\Dev\git\testpp\testpp\EMBEDDED
Java version: 1.8.0_91, vendor: Oracle Corporation
Java home: C:\Programme\Java\jdk1.8.0_91\jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
[DEBUG]   Imported: LOTS OF IMPORTS
[DEBUG] Populating class realm maven.api
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from EMBEDDED\conf\settings.xml
[DEBUG] Reading user settings from C:\Users\ph729\.m2\settings.xml
[DEBUG] Reading global toolchains from D:\Dev\git\testpp\testpp\EMBEDDED\conf\toolchains.xml
[DEBUG] Reading user toolchains from C:\Users\ph729\.m2\toolchains.xml
[DEBUG] Using local repository at C:\Users\ph729\.m2\repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for C:\Users\ph729\.m2\repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project test:testpp:pom:0.0.13-SNAPSHOT: (none)
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[DEBUG] Resolving plugin prefix release from [org.apache.maven.plugins, org.codehaus.mojo]
[DEBUG] Resolved plugin prefix release to org.apache.maven.plugins:maven-release-plugin from POM test:testpp:pom:0.0.13-SNAPSHOT
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: test:testpp:pom:0.0.13-SNAPSHOT
[DEBUG] Tasks:   [release:prepare]
[DEBUG] Style:   Aggregating
[DEBUG] =======================================================================
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building testpp 0.0.13-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[DEBUG] Resolving plugin prefix release from [org.apache.maven.plugins, org.codehaus.mojo]
[DEBUG] Resolved plugin prefix release to org.apache.maven.plugins:maven-release-plugin from POM test:testpp:pom:0.0.13-SNAPSHOT
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] === PROJECT BUILD PLAN ================================================
[DEBUG] Project:       test:testpp:0.0.13-SNAPSHOT
[DEBUG] Dependencies (collect): []
[DEBUG] Dependencies (resolve): []
[DEBUG] Repositories (dependencies): [ID (https://IP+PORT/repository/maven-public/, default, releases+snapshots), central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] Repositories (plugins)     : [ID (https://IP+PORT/repository/maven-central/, default, releases+snapshots), central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal:          org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli)
[DEBUG] Style:         Aggregating
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <addSchema default-value="true">${addSchema}</addSchema>
  <allowReleasePluginSnapshot default-value="false">${allowReleasePluginSnapshot}</allowReleasePluginSnapshot>
  <allowTimestampedSnapshots default-value="false">${ignoreSnapshots}</allowTimestampedSnapshots>
  <arguments>${arguments}</arguments>
  <autoVersionSubmodules default-value="false">${autoVersionSubmodules}</autoVersionSubmodules>
  <basedir default-value="${basedir}"/>
  <checkModificationExcludeList>${checkModificationExcludeList}</checkModificationExcludeList>
  <commitByProject default-value="false">${commitByProject}</commitByProject>
  <completionGoals default-value="">${completionGoals}</completionGoals>
  <developmentVersion>${developmentVersion}</developmentVersion>
  <dryRun default-value="false">${dryRun}</dryRun>
  <generateReleasePoms default-value="false">${generateReleasePoms}</generateReleasePoms>
  <javaHome default-value="${java.home}"/>
  <localRepoDirectory default-value="${maven.repo.local}"/>
  <mavenExecutorId default-value="invoker">${mavenExecutorId}</mavenExecutorId>
  <mavenHome default-value="${maven.home}"/>
  <password>${password}</password>
  <pomFileName>${pomFileName}</pomFileName>
  <preparationGoals default-value="clean verify">${preparationGoals}</preparationGoals>
  <project default-value="${project}"/>
  <projectVersionPolicyId default-value="default">${projectVersionPolicyId}</projectVersionPolicyId>
  <pushChanges default-value="true">${pushChanges}</pushChanges>
  <reactorProjects default-value="${reactorProjects}"/>
  <releaseVersion>${releaseVersion}</releaseVersion>
  <remoteTagging default-value="true">${remoteTagging}</remoteTagging>
  <resume default-value="true">${resume}</resume>
  <scmCommentPrefix default-value="[maven-release-plugin] ">${scmCommentPrefix}</scmCommentPrefix>
  <session default-value="${session}"/>
  <settings default-value="${settings}"/>
  <suppressCommitBeforeTag default-value="false">${suppressCommitBeforeTag}</suppressCommitBeforeTag>
  <tag>testpp-0.0.13-SNAPSHOT-m1</tag>
  <tagBase>${tagBase}</tagBase>
  <tagNameFormat default-value="@{project.artifactId}-@{project.version}">${tagNameFormat}</tagNameFormat>
  <updateDependencies default-value="true">${updateDependencies}</updateDependencies>
  <updateWorkingCopyVersions default-value="true">${updateWorkingCopyVersions}</updateWorkingCopyVersions>
  <useEditMode default-value="false">${useEditMode}</useEditMode>
  <username>${username}</username>
  <waitBeforeTagging default-value="0">${waitBeforeTagging}</waitBeforeTagging>
</configuration>
[DEBUG] =======================================================================
[INFO] 
[INFO] --- maven-release-plugin:2.5.3:prepare (default-cli) @ testpp ---
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=2, ConflictMarker.markTime=0, ConflictMarker.nodeCount=191, ConflictIdSorter.graphTime=1, ConflictIdSorter.topsortTime=1, ConflictIdSorter.conflictIdCount=68, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=11, ConflictResolver.conflictItemCount=172, DefaultDependencyCollector.collectTime=646, DefaultDependencyCollector.transformTime=17}
[DEBUG] org.apache.maven.plugins:maven-release-plugin:jar:2.5.3:
AND LOTS OF MORE
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-release-plugin:2.5.3, parent: sun.misc.Launcher$AppClassLoader@5c647e05]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare' with basic configurator -->
[DEBUG]   (f) addSchema = true
[DEBUG]   (f) allowReleasePluginSnapshot = false
[DEBUG]   (f) allowTimestampedSnapshots = false
[DEBUG]   (f) autoVersionSubmodules = false
[DEBUG]   (s) basedir = D:\Dev\git\testpp\testpp
[DEBUG]   (f) commitByProject = false
[DEBUG]   (f) dryRun = false
[DEBUG]   (f) generateReleasePoms = false
[DEBUG]   (f) javaHome = C:\Programme\Java\jdk1.8.0_91\jre
[DEBUG]   (f) mavenExecutorId = invoker
[DEBUG]   (f) mavenHome = D:\Dev\git\testpp\testpp\EMBEDDED
[DEBUG]   (f) preparationGoals = clean verify
[DEBUG]   (f) project = MavenProject: test:testpp:0.0.13-SNAPSHOT @ D:\Dev\git\testpp\testpp\pom.xml
[DEBUG]   (f) projectVersionPolicyId = default
[DEBUG]   (f) pushChanges = true
[DEBUG]   (f) reactorProjects = [MavenProject: test:testpp:0.0.13-SNAPSHOT @ D:\Dev\git\testpp\testpp\pom.xml]
[DEBUG]   (f) remoteTagging = true
[DEBUG]   (f) resume = true
[DEBUG]   (f) scmCommentPrefix = [maven-release-plugin] 
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@67a056f1
[DEBUG]   (f) settings = org.apache.maven.execution.SettingsAdapter@247667dd
[DEBUG]   (f) suppressCommitBeforeTag = false
[DEBUG]   (f) tag = testpp-0.0.13-SNAPSHOT-m1
[DEBUG]   (f) tagNameFormat = @{project.artifactId}-@{project.version}
[DEBUG]   (f) updateDependencies = true
[DEBUG]   (f) updateWorkingCopyVersions = true
[DEBUG]   (f) useEditMode = false
[DEBUG]   (f) waitBeforeTagging = 0
[DEBUG] -- end configuration --
[DEBUG] release.properties not found - using empty properties
[INFO] Verifying that there are no local modifications...
[INFO]   ignoring changes on: **\pom.xml.next, **\release.properties, **\pom.xml.branch, **\pom.xml.tag, **\pom.xml.backup, **\pom.xml.releaseBackup
[INFO] Executing: cmd.exe /X /C "git rev-parse --show-toplevel"
[INFO] Working directory: D:\Dev\git\testpp\testpp
[INFO] Executing: cmd.exe /X /C "git status --porcelain ."
[INFO] Working directory: D:\Dev\git\testpp\testpp
[DEBUG] ?? testpp/.project
[WARNING] Ignoring unrecognized line: ?? testpp/.project
[DEBUG] ?? testpp/.settings/
[WARNING] Ignoring unrecognized line: ?? testpp/.settings/
[DEBUG] ?? testpp/release.properties
[WARNING] Ignoring unrecognized line: ?? testpp/release.properties
[DEBUG] ?? testpp/target/
[WARNING] Ignoring unrecognized line: ?? testpp/target/
[INFO] Checking dependencies and plugins for snapshots ...
[INFO] Transforming 'testpp'...
[INFO] Not generating release POMs
[INFO] Executing goals 'clean verify'...
[DEBUG] Using ${maven.home} of: 'D:\Dev\git\testpp\testpp\EMBEDDED'.
[DEBUG] Executing: cmd.exe /X /C "D:\Dev\git\testpp\testpp\EMBEDDED\bin\mvn.cmd -B -X -D maven.repo.local=C:\Users\ph729\.m2\repository -s C:\Users\ph729\AppData\Local\Temp\release-settings5443953982957427387.xml clean verify"
[INFO] Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
[INFO] Maven home: D:\Dev\git\testpp\testpp\EMBEDDED
[INFO] Java version: 1.8.0_91, vendor: Oracle Corporation
[INFO] Java home: C:\Programme\Java\jdk1.8.0_91\jre
[INFO] Default locale: de_DE, platform encoding: Cp1252
[INFO] OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
[INFO] [DEBUG] Created new class realm maven.api
[INFO] [DEBUG] Importing foreign packages into class realm maven.api
[INFO] [DEBUG]   Imported: LOTS OF IMPORTS
[INFO] [DEBUG] Populating class realm maven.api
[INFO] [INFO] Error stacktraces are turned on.
[INFO] [DEBUG] Reading global settings from D:\Dev\git\testpp\testpp\EMBEDDED\conf\settings.xml
[INFO] [DEBUG] Reading user settings from C:\Users\ph729\AppData\Local\Temp\release-settings5443953982957427387.xml
[INFO] [DEBUG] Reading global toolchains from D:\Dev\git\testpp\testpp\EMBEDDED\conf\toolchains.xml
[INFO] [DEBUG] Reading user toolchains from C:\Users\ph729\.m2\toolchains.xml
[INFO] [DEBUG] Using local repository at C:\Users\ph729\.m2\repository
[INFO] [DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for C:\Users\ph729\.m2\repository
[INFO] [INFO] Scanning for projects...
[INFO] [DEBUG] Extension realms for project test:testpp:pom:0.0.13: (none)
[INFO] [DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[INFO] [DEBUG] === REACTOR BUILD PLAN ================================================
[INFO] [DEBUG] Project: test:testpp:pom:0.0.13
[INFO] [DEBUG] Tasks:   [clean, verify]
[INFO] [DEBUG] Style:   Regular
[INFO] [DEBUG] =======================================================================
[INFO]     [INFO]                                                                         
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Building testpp 0.0.13
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[INFO] [DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[INFO] [DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[INFO] [DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[INFO] [DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[INFO] [DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[INFO] [DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[INFO] [DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[INFO] [DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[INFO] [DEBUG] === PROJECT BUILD PLAN ================================================
[INFO] [DEBUG] Project:       test:testpp:0.0.13
[INFO] [DEBUG] Dependencies (collect): []
[INFO] [DEBUG] Dependencies (resolve): []
[INFO] [DEBUG] Repositories (dependencies): [ID (https://IP+PORT/repository/maven-public/, default, releases+snapshots), central (https://repo.maven.apache.org/maven2, default, releases)]
[INFO] [DEBUG] Repositories (plugins)     : [ID (https://IP+PORT/repository/maven-central/, default, releases+snapshots), central (https://repo.maven.apache.org/maven2, default, releases)]
[INFO] [DEBUG] -----------------------------------------------------------------------
[INFO] [DEBUG] Goal:          org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean)
[INFO] [DEBUG] Style:         Regular
[INFO] [DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
[INFO] <configuration>
[INFO]   <directory default-value="${project.build.directory}"/>
[INFO]   <excludeDefaultDirectories default-value="false">${clean.excludeDefaultDirectories}</excludeDefaultDirectories>
[INFO]   <failOnError default-value="true">${maven.clean.failOnError}</failOnError>
[INFO]   <followSymLinks default-value="false">${clean.followSymLinks}</followSymLinks>
[INFO]   <outputDirectory default-value="${project.build.outputDirectory}"/>
[INFO]   <reportDirectory default-value="${project.reporting.outputDirectory}"/>
[INFO]   <retryOnError default-value="true">${maven.clean.retryOnError}</retryOnError>
[INFO]   <skip default-value="false">${clean.skip}</skip>
[INFO]   <testOutputDirectory default-value="${project.build.testOutputDirectory}"/>
[INFO]   <verbose>${clean.verbose}</verbose>
[INFO] </configuration>
[INFO] [DEBUG] =======================================================================
[INFO] [INFO] 
[INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ testpp ---
[INFO] [DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=1, ConflictMarker.markTime=0, ConflictMarker.nodeCount=3, ConflictIdSorter.graphTime=1, ConflictIdSorter.topsortTime=1, ConflictIdSorter.conflictIdCount=3, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=4, ConflictResolver.conflictItemCount=3, DefaultDependencyCollector.collectTime=64, DefaultDependencyCollector.transformTime=10}
[INFO] [DEBUG] org.apache.maven.plugins:maven-clean-plugin:jar:2.5:
[INFO] [DEBUG]    org.apache.maven:maven-plugin-api:jar:2.0.6:compile
[INFO] [DEBUG]    org.codehaus.plexus:plexus-utils:jar:3.0:compile
[INFO] [DEBUG] Created new class realm plugin>org.apache.maven.plugins:maven-clean-plugin:2.5
[INFO] [DEBUG] Importing foreign packages into class realm plugin>org.apache.maven.plugins:maven-clean-plugin:2.5
[INFO] [DEBUG]   Imported:  < maven.api
[INFO] [DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-clean-plugin:2.5
[INFO] [DEBUG]   Included: org.apache.maven.plugins:maven-clean-plugin:jar:2.5
[INFO] [DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:3.0
[INFO] [DEBUG] Configuring mojo org.apache.maven.plugins:maven-clean-plugin:2.5:clean from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-clean-plugin:2.5, parent: sun.misc.Launcher$AppClassLoader@5c647e05]
[INFO] [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-clean-plugin:2.5:clean' with basic configurator -->
[INFO] [DEBUG]   (f) directory = D:\Dev\git\testpp\testpp\target
[INFO] [DEBUG]   (f) excludeDefaultDirectories = false
[INFO] [DEBUG]   (f) failOnError = true
[INFO] [DEBUG]   (f) followSymLinks = false
[INFO] [DEBUG]   (f) outputDirectory = D:\Dev\git\testpp\testpp\target\classes
[INFO] [DEBUG]   (f) reportDirectory = D:\Dev\git\testpp\testpp\target\site
[INFO] [DEBUG]   (f) retryOnError = true
[INFO] [DEBUG]   (f) skip = false
[INFO] [DEBUG]   (f) testOutputDirectory = D:\Dev\git\testpp\testpp\target\test-classes
[INFO] [DEBUG] -- end configuration --
[INFO] [INFO] Deleting D:\Dev\git\testpp\testpp\target
[INFO] [DEBUG] Skipping non-existing directory D:\Dev\git\testpp\testpp\target\classes
[INFO] [DEBUG] Skipping non-existing directory D:\Dev\git\testpp\testpp\target\test-classes
[INFO] [DEBUG] Skipping non-existing directory D:\Dev\git\testpp\testpp\target\site
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD SUCCESS
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 0.991 s
[INFO] [INFO] Finished at: 2016-09-19T14:08:12+02:00
[INFO] [INFO] Final Memory: 10M/184M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] Checking in modified POMs...
[INFO] Executing: cmd.exe /X /C "git add -- pom.xml"
[INFO] Working directory: D:\Dev\git\testpp\testpp
[INFO] Executing: cmd.exe /X /C "git rev-parse --show-toplevel"
[INFO] Working directory: D:\Dev\git\testpp\testpp
[INFO] Executing: cmd.exe /X /C "git status --porcelain ."
[INFO] Working directory: D:\Dev\git\testpp\testpp
[DEBUG] M  testpp/pom.xml
[DEBUG] ?? testpp/.project
[WARNING] Ignoring unrecognized line: ?? testpp/.project
[DEBUG] ?? testpp/.settings/
[WARNING] Ignoring unrecognized line: ?? testpp/.settings/
[DEBUG] ?? testpp/pom.xml.releaseBackup
[WARNING] Ignoring unrecognized line: ?? testpp/pom.xml.releaseBackup
[DEBUG] ?? testpp/release.properties
[WARNING] Ignoring unrecognized line: ?? testpp/release.properties
[INFO] Executing: cmd.exe /X /C "git commit --verbose -F C:\Users\ph729\AppData\Local\Temp\maven-scm-1528637449.commit pom.xml"
[INFO] Working directory: D:\Dev\git\testpp\testpp
[INFO] Executing: cmd.exe /X /C "git symbolic-ref HEAD"
[INFO] Working directory: D:\Dev\git\testpp\testpp
[INFO] Executing: cmd.exe /X /C "git push file://D:\Dev\gitremotetest\testpp refs/heads/master:refs/heads/master"
[INFO] Working directory: D:\Dev\git\testpp\testpp
[INFO] Tagging release with the label testpp-0.0.13-SNAPSHOT-m1...
[DEBUG] ScmTagPhase :: scmTagParameters remotingTag true
[DEBUG] ScmTagPhase :: scmTagParameters scmRevision null
[DEBUG] ScmTagPhase :: fileSet  basedir = D:\Dev\git\testpp\testpp; files = []
[INFO] Executing: cmd.exe /X /C "git tag -F C:\Users\ph729\AppData\Local\Temp\maven-scm-1215806812.commit testpp-0.0.13-SNAPSHOT-m1"
[INFO] Working directory: D:\Dev\git\testpp\testpp
[INFO] Executing: cmd.exe /X /C "git push file://D:\Dev\gitremotetest\testpp refs/tags/testpp-0.0.13-SNAPSHOT-m1"
[INFO] Working directory: D:\Dev\git\testpp\testpp
[INFO] Executing: cmd.exe /X /C "git ls-files"
[INFO] Working directory: D:\Dev\git\testpp\testpp
[INFO] Transforming 'testpp'...
[INFO] Not removing release POMs
[INFO] Checking in modified POMs...
[INFO] Executing: cmd.exe /X /C "git add -- pom.xml"
[INFO] Working directory: D:\Dev\git\testpp\testpp
[INFO] Executing: cmd.exe /X /C "git rev-parse --show-toplevel"
[INFO] Working directory: D:\Dev\git\testpp\testpp
[INFO] Executing: cmd.exe /X /C "git status --porcelain ."
[INFO] Working directory: D:\Dev\git\testpp\testpp
[DEBUG] M  testpp/pom.xml
[DEBUG] ?? testpp/.project
[WARNING] Ignoring unrecognized line: ?? testpp/.project
[DEBUG] ?? testpp/.settings/
[WARNING] Ignoring unrecognized line: ?? testpp/.settings/
[DEBUG] ?? testpp/pom.xml.releaseBackup
[WARNING] Ignoring unrecognized line: ?? testpp/pom.xml.releaseBackup
[DEBUG] ?? testpp/release.properties
[WARNING] Ignoring unrecognized line: ?? testpp/release.properties
[INFO] Executing: cmd.exe /X /C "git commit --verbose -F C:\Users\ph729    \AppData\Local\Temp\maven-scm-1020827492.commit pom.xml"
[INFO] Working directory: D:\Dev\git\testpp\testpp
[INFO] Executing: cmd.exe /X /C "git symbolic-ref HEAD"
[INFO] Working directory: D:\Dev\git\testpp\testpp
[INFO] Executing: cmd.exe /X /C "git push file://D:\Dev\gitremotetest\testpp refs/heads/master:refs/heads/master"
[INFO] Working directory: D:\Dev\git\testpp\testpp
[INFO] Release preparation complete.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.132 s
[INFO] Finished at: 2016-09-19T14:08:14+02:00
[INFO] Final Memory: 11M/152M
[INFO] ------------------------------------------------------------------------

我的问题是,maven release插件有这么多配置标签,但没有git文档。我从未与svn合作过,我是Git的新手。

我的问题的解决方案会很好,一个好的使用git的maven发布插件的文章将是最好的。

编辑1:@khmarbaise:这是我制作mvn版本:prepare和版本:perform时的git输出(包括khmarbaises第一条评论的更改)。

深蓝色SO commit标志着从主分支开始的发布,浅蓝色标志着从develop开始的发布。

变更后的pom:

<project>
...
    <scm>
        <connection>scm:git:file:///D:/Dev/gitremotetest/testpp</connection>
        <developerConnection>scm:git:file:///D:/Dev/gitremotetest/testpp</developerConnection>
        <tag>HEAD</tag>
    </scm>
...
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <branchName>develop</branchName>
                    <pushChanges>false</pushChanges>
                    <localCheckout>true</localCheckout>
                </configuration>
            </plugin>
        </plugins>
    </build>
...
</project>

我的目标结果是:

从develope开始发布将标签和发布版本提交给master branch,并将下一个开发版本提交给develope branch。(我认为这应该是发布的共同结果)

编辑2:@CptS:如果我启动一个jgitflow:启动-发布我得到这个信息:

[INFO] --- jgitflow-maven-plugin:1.0-m5.1:release-start (default-cli) @ testb ---
[WARNING] ..oo00 ---- WARNING ---- 00oo..
[WARNING] core.autocrlf is set to true but is NOT supported by JGit or JGitFlow!
[WARNING] 00oo.. you have been warned 00oo..

我工作的公司使用这种设置。

编辑3:我选择了JGitFlow插件供我使用。(配置和使用不到1分钟。)

共有1个答案

汪志业
2023-03-14

我通常使用mvn版本:prepare(准备),然后使用mvn版本:perform(执行),这允许我从快照移动到最终版本等。。

 类似资料:
  • 我已经按照本页上的说明进行了操作,但是当我试图运行一个简单的示例代码来测试它时,我得到了一个异常: unsatisfiedLinkError:无法加载库:C:\eclipse 3.8 32位\natives\windows-amd64\gluegen-rt.dll null null

  • 我正在努力学习git。 我的git存储库在Visual Studio Team Services上。我在Visual Studio中编码。我使用git bash。 我想通过命令行使用git(我想了解正在发生的事情)。 首先,我从Web浏览器在TFS上创建了一个新的git项目。我确实设置了ssh,这样我就可以从git bash执行命令。它起作用了。 > 当您在TFS中创建git项目时,它是在服务器上

  • 问题内容: 我一直在努力建立我的cordova插件项目。主要由于以下事实: 插件需要位于远离主项目的单独文件夹中 例如,当我使用它来构建项目时,cordova从我的插件文件夹中复制java文件并将其放入文件夹中。 因此,我不应该在Android项目中手动修改插件的.java文件,而必须在插件文件夹中编写代码。 但是我无法将插件文件夹导入到IDE项目中,因此我没有代码完成功能。 没有IDE支持,基本

  • 我有一个多模块项目,所有模块都有一个公共的父pom和一个聚合器/构建pom。我试图使用maven版本插件来更新/设置我所有模块的版本,但它一直跳过子模块。 项目布局:-通用/pom.xml(build pom)-通用/Superpom/pom.xml(父pom)-模块1/pom.xml(模块1 pom)-模块2/pom.xml(模块2 pom) 普通/聚甲醛。xml: 我尝试将插件添加到构建pom

  • 问题内容: 如何使用jQuery设置和取消设置Cookie,例如创建一个名为的Cookie 并将其值设置为? 问题答案: 2019年4月更新 Cookie的读取/操作不需要jQuery,因此请不要使用下面的原始答案。 转到https://github.com/js-cookie/js-cookie,然后在其中使用不依赖jQuery的库。 基本示例: 有关详细信息,请参见github上的文档。 参见