You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2023/08/14 00:52:00 UTC
[jira] [Commented] (MRELEASE-1054) [Git submodule] Wrong Change on scm submodule after release:prepare and failed on pushChange
[ https://issues.apache.org/jira/browse/MRELEASE-1054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17753863#comment-17753863 ]
ASF GitHub Bot commented on MRELEASE-1054:
------------------------------------------
elharo commented on code in PR #196:
URL: https://github.com/apache/maven-release/pull/196#discussion_r1292889605
##########
maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractMapVersionsPhase.java:
##########
@@ -39,6 +43,7 @@
import org.apache.maven.shared.release.versions.VersionParseException;
import org.codehaus.plexus.components.interactivity.Prompter;
import org.codehaus.plexus.components.interactivity.PrompterException;
+import org.codehaus.plexus.util.SelectorUtils;
Review Comment:
I'd like to avoid addition al plexus dependencies if at all possible.
##########
maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java:
##########
@@ -142,6 +147,15 @@ public ReleaseResult execute(
throws ReleaseExecutionException, ReleaseFailureException {
ReleaseResult result = new ReleaseResult();
+ List<String> additionalExcludes = releaseDescriptor.getCheckModificationExcludes();
+
+ if (additionalExcludes != null) {
+ for (String additionalExclude : additionalExcludes) {
+ exclusionPatterns.add(
+ additionalExclude.replace("\\", File.separator).replace("/", File.separator));
Review Comment:
same as above
##########
maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractMapVersionsPhase.java:
##########
@@ -118,6 +125,15 @@ public ReleaseResult execute(
throws ReleaseExecutionException {
ReleaseResult result = new ReleaseResult();
+ List<String> additionalExcludes = releaseDescriptor.getCheckModificationExcludes();
+
+ if (additionalExcludes != null) {
+ for (String additionalExclude : additionalExcludes) {
+ exclusionPatterns.add(
+ additionalExclude.replace("\\", File.separator).replace("/", File.separator));
Review Comment:
File.separator is platform dependent, but I'm not sure it should be here. That is, exclusions should be specified in a platform independent, standard way. I could be wrong about that but if I am, please elaborate in detail on how this works with references to docs.
##########
maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java:
##########
@@ -199,13 +213,18 @@ private void transform(
for (MavenProject project : reactorProjects) {
URI pom = project.getFile().toURI();
- logInfo(
- result,
- "Transforming " + root.relativize(pom).getPath() + ' '
- + buffer().project(project.getArtifactId()) + " '" + project.getName() + "'"
- + (simulate ? " with ." + getPomSuffix() + " suffix" : "") + "...");
+ final String path = root.relativize(pom).getPath();
+
+ if (exclusionPatterns.stream()
+ .noneMatch(exclusionPattern -> SelectorUtils.matchPath(exclusionPattern, path))) {
+ logInfo(
Review Comment:
why log this? debug level at most
##########
maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractMapVersionsPhase.java:
##########
@@ -165,17 +181,24 @@ public ReleaseResult execute(
}
}
} else {
+ URI root = rootProject.getBasedir().toURI();
for (MavenProject project : reactorProjects) {
String projectId = ArtifactUtils.versionlessKey(project.getGroupId(), project.getArtifactId());
String nextVersion = resolveNextVersion(project, projectId, releaseDescriptor, releaseEnvironment);
- if (!convertToSnapshot) {
- releaseDescriptor.addReleaseVersion(projectId, nextVersion);
- } else if (releaseDescriptor.isBranchCreation() && convertToBranch) {
- releaseDescriptor.addReleaseVersion(projectId, nextVersion);
- } else {
- releaseDescriptor.addDevelopmentVersion(projectId, nextVersion);
+ URI pom = project.getFile().toURI();
+ final String path = root.relativize(pom).getPath();
+
+ if (exclusionPatterns.stream()
+ .noneMatch(exclusionPattern -> SelectorUtils.matchPath(exclusionPattern, path))) {
Review Comment:
a basic loop with no lambdas would be easier to read
> [Git submodule] Wrong Change on scm submodule after release:prepare and failed on pushChange
> --------------------------------------------------------------------------------------------
>
> Key: MRELEASE-1054
> URL: https://issues.apache.org/jira/browse/MRELEASE-1054
> Project: Maven Release Plugin
> Issue Type: Bug
> Components: Git, prepare, scm
> Affects Versions: 3.0.0-M1
> Reporter: Cau Ta
> Priority: Major
> Attachments: Screen Shot 2020-07-29 at 13.54.41.png
>
>
> *My project structure:*
> {{parent (git scm repo parent.git)}}
> {{-- git submodule A (git scm repo a.git)}}
> {{-- git submodule B (git scm repo b.git)}}
> {{-- git submodule C (git scm repo c.git)}}
> my maven release plugin config on parent pom.xml:
> _<plugin>_
> _<groupId>org.apache.maven.plugins</groupId>_
> _<artifactId>maven-release-plugin</artifactId>_
> _<version>3.0.0-M1</version>_
> _<configuration>_
> _<!-- <preparationGoals>deploy</preparationGoals>-->_
> _<tagNameFormat>v@\{project.version}</tagNameFormat>_
> _<autoVersionSubmodules>true</autoVersionSubmodules>_
> _<commitByProject>true</commitByProject>_
> _<allowTimestampedSnapshots>true</allowTimestampedSnapshots>_
> _<pushChanges>false</pushChanges>_
> _</configuration>_
> _</plugin>_
>
> The release was successful but after release:prepare the scm config of all submodule has been change.
> [Please take a look at the attachment]
> *--------------------------------------------------------------*
> *Another bug i have been faced is:*
> when enable push change (_<pushChanges>true</pushChanges>_)
> the release:prepare got stuck after push change at the first git submodule
> _[INFO] Executing: /bin/sh -c cd repository/beowulf/beowulf-libs/constant && git push git@github.com:beowulfchain-libs/beowulf-libs.git refs/heads/master:refs/heads/master_
> _[INFO] Working directory: repository/beowulf/beowulf-libs/constant_
> _[INFO] ------------------------------------------------------------------------_
> _[INFO] Reactor Summary for beowulf 1.0-SNAPSHOT:_
> _[INFO]_
> _[INFO] beowulf ............................................ FAILURE [ 42.033 s]_
> _[INFO] constant ........................................... SKIPPED_
> _[INFO] core ............................................... SKIPPED_
> _[INFO] utils .............................................. SKIPPED_
> _[INFO] domain ............................................. SKIPPED_
> _[INFO] config ............................................. SKIPPED_
> _[INFO] logging ............................................ SKIPPED_
> _[INFO] ------------------------------------------------------------------------_
> _[INFO] BUILD FAILURE_
> _[INFO] ------------------------------------------------------------------------_
> _[INFO] Total time: 42.709 s_
> _[INFO] Finished at: 2020-07-28T17:51:04+07:00_
> _[INFO] ------------------------------------------------------------------------_
> _[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:3.0.0-M1:prepare (default-cli) on project beowulf: Unable to commit files_
> _[ERROR] Provider message:_
> _[ERROR] The git-push command failed._
> _[ERROR] Command output:_
> _[ERROR] Warning: Permanently added the RSA host key for IP address 'xxx.xxx.xxx.3' to the list of known hosts._
> _[ERROR] To github.com:beowulfchain-libs/beowulf-libs.git_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)