mirror of https://github.com/apache/maven.git
MNG-5530 simplified MojoExecutionScope binding
Signed-off-by: Igor Fedorenko <ifedorenko@apache.org>
This commit is contained in:
parent
8700b05857
commit
2ef658430f
|
@ -1,45 +0,0 @@
|
|||
package org.apache.maven.execution.scope.internal;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.apache.maven.execution.scope.MojoExecutionScoped;
|
||||
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.name.Names;
|
||||
|
||||
@Named
|
||||
public class MojoExecutionModule
|
||||
implements Module
|
||||
{
|
||||
|
||||
public void configure( Binder binder )
|
||||
{
|
||||
final MojoExecutionScope executionScope = new MojoExecutionScope();
|
||||
|
||||
// tell Guice about the scope
|
||||
binder.bindScope( MojoExecutionScoped.class, executionScope );
|
||||
|
||||
// make our scope instance injectable
|
||||
binder.bind( MojoExecutionScope.class ).annotatedWith( Names.named( MojoExecutionScope.SCOPE_NAME ) ).toInstance( executionScope );
|
||||
}
|
||||
}
|
|
@ -22,6 +22,9 @@ package org.apache.maven.execution.scope.internal;
|
|||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.execution.scope.MojoExecutionListener;
|
||||
import org.apache.maven.execution.scope.MojoExecutionScoped;
|
||||
|
@ -40,11 +43,11 @@ import com.google.inject.Provider;
|
|||
import com.google.inject.Scope;
|
||||
import com.google.inject.util.Providers;
|
||||
|
||||
@Named
|
||||
@Singleton
|
||||
public class MojoExecutionScope
|
||||
implements Scope
|
||||
{
|
||||
public static final String SCOPE_NAME = "mojoExecution";
|
||||
|
||||
private static final Provider<Object> SEEDED_KEY_PROVIDER = new Provider<Object>()
|
||||
{
|
||||
public Object get()
|
||||
|
|
|
@ -49,7 +49,7 @@ public class DefaultBuildPluginManager
|
|||
@Requirement
|
||||
private LegacySupport legacySupport;
|
||||
|
||||
@Requirement( hint = MojoExecutionScope.SCOPE_NAME )
|
||||
@Requirement
|
||||
private MojoExecutionScope scope;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue