You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2022/05/29 17:44:22 UTC

[maven-release] branch MRELEASE-1097 updated: [MRELEASE-079] drop under-used message bundle

This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to branch MRELEASE-1097
in repository https://gitbox.apache.org/repos/asf/maven-release.git


The following commit(s) were added to refs/heads/MRELEASE-1097 by this push:
     new 731ee7ce [MRELEASE-079] drop under-used message bundle
731ee7ce is described below

commit 731ee7ce5ebf795e36bb82f710520f3ff5fb513f
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Sun May 29 19:44:20 2022 +0200

    [MRELEASE-079] drop under-used message bundle
---
 .../release/phase/AbstractMapVersionsPhase.java    | 38 ++++++++--------------
 .../src/main/resources/release-messages.properties | 21 ------------
 .../main/resources/release-messages_en.properties  | 23 -------------
 3 files changed, 14 insertions(+), 68 deletions(-)

diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractMapVersionsPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractMapVersionsPhase.java
index 61940e08..6a3df9c8 100644
--- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractMapVersionsPhase.java
+++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractMapVersionsPhase.java
@@ -21,9 +21,7 @@ package org.apache.maven.shared.release.phase;
 
 import java.text.MessageFormat;
 import java.util.List;
-import java.util.Locale;
 import java.util.Map;
-import java.util.ResourceBundle;
 
 import org.apache.maven.artifact.ArtifactUtils;
 import org.apache.maven.project.MavenProject;
@@ -110,8 +108,6 @@ public abstract class AbstractMapVersionsPhase
     {
         ReleaseResult result = new ReleaseResult();
 
-        ResourceBundle resourceBundle = getResourceBundle( releaseEnvironment.getLocale() );
-
         MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects );
 
         if ( releaseDescriptor.isAutoVersionSubmodules() && ArtifactUtils.isSnapshot( rootProject.getVersion() ) )
@@ -121,7 +117,7 @@ public abstract class AbstractMapVersionsPhase
 
             String projectId = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() );
 
-            String nextVersion = resolveNextVersion( project, projectId, releaseDescriptor, resourceBundle );
+            String nextVersion = resolveNextVersion( project, projectId, releaseDescriptor );
 
             if ( !convertToSnapshot )
             {
@@ -187,7 +183,7 @@ public abstract class AbstractMapVersionsPhase
             {
                 String projectId = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() );
 
-                String nextVersion = resolveNextVersion( project, projectId, releaseDescriptor, resourceBundle );
+                String nextVersion = resolveNextVersion( project, projectId, releaseDescriptor );
 
                 if ( !convertToSnapshot )
                 {
@@ -211,8 +207,7 @@ public abstract class AbstractMapVersionsPhase
 
     private String resolveNextVersion( MavenProject project,
                                        String projectId,
-                                       ReleaseDescriptor releaseDescriptor,
-                                       ResourceBundle resourceBundle )
+                                       ReleaseDescriptor releaseDescriptor )
             throws ReleaseExecutionException
     {
         String defaultVersion;
@@ -257,7 +252,7 @@ public abstract class AbstractMapVersionsPhase
 
         String suggestedVersion = null;
         String nextVersion = defaultVersion;
-        String messageKey = null;
+        String messageFormat = null;
         try
         {
             while ( nextVersion == null || ArtifactUtils.isSnapshot( nextVersion ) != convertToSnapshot )
@@ -305,11 +300,11 @@ public abstract class AbstractMapVersionsPhase
 
                 if ( releaseDescriptor.isInteractive() )
                 {
-                    if ( messageKey == null )
+                    if ( messageFormat == null )
                     {
-                        messageKey = getMapversionPromptKey( releaseDescriptor );
+                        messageFormat = getMapversionPromptFormat( releaseDescriptor );
                     }
-                    String message = MessageFormat.format( resourceBundle.getString( messageKey ), project.getName(),
+                    String message = MessageFormat.format( messageFormat, project.getName(),
                                                            buffer().project( project.getArtifactId() ) );
                     nextVersion = prompter.prompt( message, suggestedVersion );
 
@@ -385,26 +380,26 @@ public abstract class AbstractMapVersionsPhase
     }
 
 
-    private String getMapversionPromptKey( ReleaseDescriptor releaseDescriptor )
+    private String getMapversionPromptFormat( ReleaseDescriptor releaseDescriptor )
     {
-        String messageKey;
+        String context;
         if ( convertToBranch )
         {
-            messageKey = "mapversion.branch.prompt";
+            context = "branch";
         }
         else if ( !convertToSnapshot )
         {
-            messageKey = "mapversion.release.prompt";
+            context = "release";
         }
         else if ( releaseDescriptor.isBranchCreation() )
         {
-            messageKey = "mapversion.workingcopy.prompt";
+            context = "new working copy";
         }
         else
         {
-            messageKey = "mapversion.development.prompt";
+            context = "new development";
         }
-        return messageKey;
+        return "What is the " + context + " version for \"{0}\"? ({1})";
     }
 
     @Override
@@ -421,9 +416,4 @@ public abstract class AbstractMapVersionsPhase
 
         return result;
     }
-
-    private ResourceBundle getResourceBundle( Locale locale )
-    {
-        return ResourceBundle.getBundle( "release-messages", locale, AbstractMapVersionsPhase.class.getClassLoader() );
-    }
 }
diff --git a/maven-release-manager/src/main/resources/release-messages.properties b/maven-release-manager/src/main/resources/release-messages.properties
deleted file mode 100644
index 2083f31f..00000000
--- a/maven-release-manager/src/main/resources/release-messages.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-mapversion.branch.prompt      = What is the branch version for "{0}"? ({1})
-mapversion.development.prompt = What is the new development version for "{0}"? ({1})
-mapversion.release.prompt     = What is the release version for "{0}"? ({1})
-mapversion.workingcopy.prompt = What is the new working copy version for "{0}"? ({1})
diff --git a/maven-release-manager/src/main/resources/release-messages_en.properties b/maven-release-manager/src/main/resources/release-messages_en.properties
deleted file mode 100644
index 96cf4075..00000000
--- a/maven-release-manager/src/main/resources/release-messages_en.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# NOTE:
-# This bundle is intentionally empty because English strings are provided by the base bundle via the parent chain. It
-# must be provided nevertheless such that a request for locale "en" will not errorneously pick up the bundle for the
-# JVM's default locale (which need not be "en"). See the method javadoc about
-#   ResourceBundle.getBundle(String, Locale, ClassLoader)
-# for a full description of the lookup strategy.