You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2018/01/21 13:08:32 UTC
[maven-release] 02/04: No need for reflection anymore
This is an automated email from the ASF dual-hosted git repository.
rfscholte pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-release.git
commit 0c38681f88cb49c75cee859725759de75145044a
Author: rfscholte <rf...@apache.org>
AuthorDate: Fri Jan 19 18:14:35 2018 +0100
No need for reflection anymore
---
.../maven/plugins/release/AbstractReleaseMojo.java | 40 +---------------------
1 file changed, 1 insertion(+), 39 deletions(-)
diff --git a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java
index ed8b0d6..f6242ed 100644
--- a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java
+++ b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java
@@ -20,14 +20,10 @@ package org.apache.maven.plugins.release;
*/
import java.io.File;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.apache.maven.execution.MavenSession;
-import org.apache.maven.model.Profile;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Parameter;
@@ -163,7 +159,7 @@ public abstract class AbstractReleaseMojo
descriptor.setPomFileName( pomFileName );
- List<String> profileIds = getActiveProfileIds();
+ List<String> profileIds = session.getRequest().getActiveProfiles();
String additionalProfiles = getAdditionalProfiles();
String args = this.arguments;
@@ -204,40 +200,6 @@ public abstract class AbstractReleaseMojo
}
/**
- *
- * @return a List with profile ids, never {@code null}
- */
- @SuppressWarnings( "unchecked" )
- private List<String> getActiveProfileIds()
- {
- List<String> profiles;
- try
- {
- // Try to use M3-methods
- Method getRequestMethod = this.session.getClass().getMethod( "getRequest" );
- Object mavenExecutionRequest = getRequestMethod.invoke( this.session );
- Method getActiveProfilesMethod = mavenExecutionRequest.getClass().getMethod( "getActiveProfiles" );
- profiles = (List<String>) getActiveProfilesMethod.invoke( mavenExecutionRequest );
- }
- catch ( Exception e )
- {
- if ( project.getActiveProfiles() == null || project.getActiveProfiles().isEmpty() )
- {
- profiles = Collections.emptyList();
- }
- else
- {
- profiles = new ArrayList<>( project.getActiveProfiles().size() );
- for ( Object profile : project.getActiveProfiles() )
- {
- profiles.add( ( (Profile) profile ).getId() );
- }
- }
- }
- return profiles;
- }
-
- /**
* Gets the comma separated list of additional profiles for the release build.
*
* @return additional profiles to enable during release
--
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.