org.nuiton.helper.plugin
Class CheckAutoContainerPlugin

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.nuiton.plugin.AbstractPlugin
          extended by org.nuiton.helper.plugin.CheckAutoContainerPlugin
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, Plugin

public class CheckAutoContainerPlugin
extends AbstractPlugin

Check all dependencies are auto contained in the given repositories.

Since:
1.2.5
Version:
$Id: CheckAutoContainerPlugin.java 776 2010-10-23 11:44:57Z tchemit $
Author:
tchemit
Is defined by the goal name:
check-auto-container
Is bound to the specified phase of the standard build lifecycle:
validate
Requires the dependencies in this specified scope:
runtime
Requires to be online to run:
true
Requires a Maven project to run:
true

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.nuiton.plugin.Plugin
Plugin.InitState, Plugin.Packaging
 
Field Summary
protected  boolean addMavenCentral
          A flag to add the maven central repository http://repo1.maven.org/maven2 to repositories.
protected  org.apache.maven.artifact.repository.ArtifactRepositoryFactory artifactRepositoryFactory
          Artifact repository factory component.
protected  org.apache.maven.artifact.factory.ArtifactFactory factory
          Artifact factory component.
protected  boolean failIfNotSafe
          A flag to fail if project is not auto container.
protected  org.apache.maven.artifact.repository.ArtifactRepository localRepository
          Local repository.
static String MAVEN_CENTRAL_ID
           
static String MAVEN_CENTRAL_URL
           
protected  org.apache.maven.project.MavenProject project
          Project.
protected  org.apache.maven.settings.Proxy proxy
          Active proxy from settings (if any).
protected  List<?> reactorProjects
          The projects in reactor (used to detected sibling dependencies).
protected  Map<String,String> repositories
          Map of repositories to use.
protected  org.apache.maven.artifact.resolver.ArtifactResolver resolver
          Artifact resolver component.
protected  boolean runOnce
          A flag to execute only once the mojo.
protected  boolean verbose
          A flag to activate verbose mode.
protected  org.apache.maven.artifact.manager.WagonManager wagonManager
          Wagon manager component.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
CheckAutoContainerPlugin()
           
 
Method Summary
protected  org.apache.maven.artifact.Artifact acceptArtifact(org.apache.maven.artifact.Artifact a, List<String> siblings)
           
protected  boolean checkAlreadyExecuted()
           
protected  boolean checkSkip()
          Checks if the mojo execution should be skipped.
protected  List<org.apache.maven.artifact.repository.ArtifactRepository> createSafeRepositories()
           
protected  void disconnect(org.apache.maven.wagon.Wagon wagon)
           
protected  void doAction()
          Do plugin action.
protected  String getArtifactId(org.apache.maven.artifact.Artifact artifact)
           
 org.apache.maven.project.MavenProject getProject()
           
protected  org.apache.maven.wagon.proxy.ProxyInfo getProxyInfo()
           
protected  List<String> getRepositoryCache(String url)
           
protected  org.apache.maven.wagon.Wagon getWagon(org.apache.maven.artifact.repository.ArtifactRepository repo)
           
 void init()
          Method to initialize the mojo before doing any concrete actions.
 boolean isVerbose()
           
protected  List<org.apache.maven.artifact.Artifact> prepareArtifacts()
           
 void setProject(org.apache.maven.project.MavenProject project)
           
 void setVerbose(boolean verbose)
           
 
Methods inherited from class org.nuiton.plugin.AbstractPlugin
acceptPackaging, addCompileSourceRoots, addDirectoryToUrlsList, addResourceDir, addTestCompileSourceRoots, addTestResourceDir, addUrlToUrlsList, afterExecute, backupFile, checkEncoding, checkPackaging, checkResource, checkRunOnceDone, copyFile, createDirectoryIfNecessary, createNewFile, deleteFile, execute, getBackupFile, getFileFromBasedir, getFilesToTreate, getFilesToTreateForRoots, getRootProject, getTemplate, hasClassPath, initClassLoader, isExecutionRoot, isFileNewerThanPomFile, rejectPackaging, removeCompileSourceRoots, removeTestCompileSourceRoots, renameFile, writeFile
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.maven.plugin.Mojo
getLog, setLog
 

Field Detail

repositories

protected Map<String,String> repositories
Map of repositories to use.

Keys are repository id and Values are repository url.

Since:
1.2.5
Is defined by:

addMavenCentral

protected boolean addMavenCentral
A flag to add the maven central repository http://repo1.maven.org/maven2 to repositories.

Since:
1.2.5
Is defined by:
expression:
${addMavenCentral}
default-value:
false

failIfNotSafe

protected boolean failIfNotSafe
A flag to fail if project is not auto container.

Since:
1.2.5
Is defined by:
expression:
${helper.failIfNotSafe}
default-value:
false

verbose

protected boolean verbose
A flag to activate verbose mode.

Since:
1.2.5
Is defined by:
expression:
${helper.verbose}
default-value:
${maven.verbose}

runOnce

protected boolean runOnce
A flag to execute only once the mojo.

Note: By default, value is true since it is not necessary to check twice for a same artifact.

Since:
1.2.6
Is defined by:
expression:
${helper.runOnce}
default-value:
true

project

protected org.apache.maven.project.MavenProject project
Project.

Since:
1.2.5
Is defined by:
default-value:
${project}
Is readonly.
Is required.

reactorProjects

protected List<?> reactorProjects
The projects in reactor (used to detected sibling dependencies).

Since:
1.2.5
Is defined by:
expression:
${reactorProjects}
Is readonly.

proxy

protected org.apache.maven.settings.Proxy proxy
Active proxy from settings (if any).

Since:
1.2.5
Is defined by:
default-value:
${settings.activeProxy}
Is readonly.
Is required.

localRepository

protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
Local repository.

Since:
1.2.5
Is defined by:
expression:
${localRepository}
Is readonly.
Is required.

artifactRepositoryFactory

protected org.apache.maven.artifact.repository.ArtifactRepositoryFactory artifactRepositoryFactory
Artifact repository factory component.

Since:
1.2.5
Is a Plexus component defined by:
Is readonly.
Is required.

factory

protected org.apache.maven.artifact.factory.ArtifactFactory factory
Artifact factory component.

Since:
1.2.5
Is a Plexus component defined by:
Is readonly.
Is required.

resolver

protected org.apache.maven.artifact.resolver.ArtifactResolver resolver
Artifact resolver component.

Since:
1.2.5
Is a Plexus component defined by:
Is readonly.
Is required.

wagonManager

protected org.apache.maven.artifact.manager.WagonManager wagonManager
Wagon manager component.

Since:
1.2.5
Is a Plexus component defined by:
Is readonly.
Is required.

MAVEN_CENTRAL_ID

public static final String MAVEN_CENTRAL_ID
See Also:
Constant Field Values

MAVEN_CENTRAL_URL

public static final String MAVEN_CENTRAL_URL
See Also:
Constant Field Values
Constructor Detail

CheckAutoContainerPlugin

public CheckAutoContainerPlugin()
Method Detail

getProject

public org.apache.maven.project.MavenProject getProject()

setProject

public void setProject(org.apache.maven.project.MavenProject project)

isVerbose

public boolean isVerbose()

setVerbose

public void setVerbose(boolean verbose)

init

public void init()
          throws Exception
Description copied from class: AbstractPlugin
Method to initialize the mojo before doing any concrete actions.

Note: The method is invoked before the AbstractPlugin.doAction() method.

Specified by:
init in class AbstractPlugin
Throws:
Exception - if any

checkAlreadyExecuted

protected boolean checkAlreadyExecuted()

checkSkip

protected boolean checkSkip()
Description copied from class: AbstractPlugin
Checks if the mojo execution should be skipped.

Overrides:
checkSkip in class AbstractPlugin
Returns:
false if the mojo should not be executed.

doAction

protected void doAction()
                 throws Exception
Description copied from class: AbstractPlugin
Do plugin action.

The method AbstractPlugin.execute() invoke this method only and only if :

Specified by:
doAction in class AbstractPlugin
Throws:
Exception - if any

createSafeRepositories

protected List<org.apache.maven.artifact.repository.ArtifactRepository> createSafeRepositories()

prepareArtifacts

protected List<org.apache.maven.artifact.Artifact> prepareArtifacts()

acceptArtifact

protected org.apache.maven.artifact.Artifact acceptArtifact(org.apache.maven.artifact.Artifact a,
                                                            List<String> siblings)

getArtifactId

protected String getArtifactId(org.apache.maven.artifact.Artifact artifact)

getRepositoryCache

protected List<String> getRepositoryCache(String url)

getWagon

protected org.apache.maven.wagon.Wagon getWagon(org.apache.maven.artifact.repository.ArtifactRepository repo)
                                         throws Exception
Throws:
Exception

disconnect

protected void disconnect(org.apache.maven.wagon.Wagon wagon)

getProxyInfo

protected org.apache.maven.wagon.proxy.ProxyInfo getProxyInfo()


Copyright © 2009-2010 CodeLutin. All Rights Reserved.