diff --git a/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java b/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java index 46c41b94e75d..196b4b7d602b 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java @@ -123,8 +123,7 @@ else if ( metadataFile.exists() ) // beware meta-versions! String version = metadata.getVersion(); - if ( version != null && ( Artifact.LATEST_VERSION.equals( version ) || Artifact.RELEASE_VERSION.equals( - version ) ) ) + if ( Artifact.LATEST_VERSION.equals( version ) || Artifact.RELEASE_VERSION.equals( version ) ) { // meta-versions are not valid values...don't write them. metadata.setVersion( null ); diff --git a/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java b/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java index a4835fdd473b..cf3d746f889d 100644 --- a/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java +++ b/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java @@ -243,12 +243,11 @@ public ClassRealm createExtensionRealm( Plugin plugin, List artifacts { Objects.requireNonNull( plugin, "plugin cannot be null" ); - ClassLoader parent = PARENT_CLASSLOADER; - Map foreignImports = Collections.singletonMap( "", getMavenApiRealm() ); - return createRealm( getKey( plugin, true ), RealmType.Extension, parent, null, foreignImports, artifacts ); + return createRealm( getKey( plugin, true ), RealmType.Extension, PARENT_CLASSLOADER, null, + foreignImports, artifacts ); } private boolean isProvidedArtifact( Artifact artifact ) diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoDescriptorCreator.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoDescriptorCreator.java index edb8dceda0bb..4bafa30c69b3 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoDescriptorCreator.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoDescriptorCreator.java @@ -190,7 +190,7 @@ else if ( numTokens == 3 ) plugin.setArtifactId( tok.nextToken() ); goal = tok.nextToken(); } - else if ( numTokens <= 2 ) + else { // We have a prefix and goal // diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 5ca060206ce1..79e1ffeac721 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -337,7 +337,7 @@ void initialize( CliRequest cliRequest ) "-D%s system property is not set.", MULTIMODULE_PROJECT_DIRECTORY ); throw new ExitException( 1 ); } - File basedir = basedirProperty != null ? new File( basedirProperty ) : new File( "" ); + File basedir = new File( basedirProperty ); try { cliRequest.multiModuleProjectDirectory = basedir.getCanonicalFile(); @@ -764,7 +764,7 @@ protected void configure() MavenExecutionRequest request = DefaultMavenExecutionRequest.copy( cliRequest.request ); - request = populateRequest( cliRequest, request ); + populateRequest( cliRequest, request ); request = executionRequestPopulator.populateDefaults( request );