MNG-5530 simplified MojoExecutionScope binding

Signed-off-by: Igor Fedorenko <ifedorenko@apache.org>
This commit is contained in:
Igor Fedorenko 2013-11-18 09:41:15 -05:00
parent 8700b05857
commit 2ef658430f
3 changed files with 6 additions and 48 deletions

View File

@ -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 );
}
}

View File

@ -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()

View File

@ -49,7 +49,7 @@ public class DefaultBuildPluginManager
@Requirement
private LegacySupport legacySupport;
@Requirement( hint = MojoExecutionScope.SCOPE_NAME )
@Requirement
private MojoExecutionScope scope;
/**