org.apache.maven.plugin.ide
Class IdeUtils

java.lang.Object
  extended by org.apache.maven.plugin.ide.IdeUtils

public class IdeUtils
extends Object

Version:
$Id: IdeUtils.java 597410 2007-11-22 13:59:27Z aheritier $
Author:
Trygve Laugstøl, Fabrizio Giustina

Field Summary
static String JAVA_1_1
           
static String JAVA_1_2
           
static String JAVA_1_3
           
static String JAVA_1_4
           
static String JAVA_5_0
           
static String JAVA_6_0
           
static String PROJECT_NAME_DEFAULT_TEMPLATE
           
static String PROJECT_NAME_WITH_GROUP_AND_VERSION_TEMPLATE
           
static String PROJECT_NAME_WITH_GROUP_TEMPLATE
           
static String PROJECT_NAME_WITH_VERSION_TEMPLATE
           
 
Method Summary
static String getArtifactVersion(String[] artifactIds, List dependencies, int len)
          Extracts the version of the first matching artifact in the given list.
static String getCanonicalPath(File file)
           
static String getCompilerPluginSetting(org.apache.maven.project.MavenProject project, String optionName)
          Returns a compiler plugin settings, considering also settings altered in plugin executions .
static String getCompilerSourceVersion(org.apache.maven.project.MavenProject project)
          Returns the source version configured for the compiler plugin.
static String getCompilerTargetVersion(org.apache.maven.project.MavenProject project)
          Returns the target version configured for the compiler plugin.
static org.codehaus.plexus.util.xml.Xpp3Dom getPluginConfigurationDom(org.apache.maven.project.MavenProject project, String pluginId)
          Search for the configuration Xpp3 dom of an other plugin.
static org.codehaus.plexus.util.xml.Xpp3Dom[] getPluginConfigurationDom(org.apache.maven.project.MavenProject project, String artifactId, String[] subConfiguration)
          Search for the configuration Xpp3 dom of an other plugin.
static String getPluginSetting(org.apache.maven.project.MavenProject project, String pluginId, String optionName, String defaultValue)
          Search for a configuration setting of an other plugin for a configuration setting.
static String getProjectName(IdeDependency dep, boolean addVersionToProjectName)
           
static String getProjectName(org.apache.maven.project.MavenProject project, boolean addVersionToProjectName)
           
static String getProjectName(String template, org.apache.maven.artifact.Artifact artifact)
          Use the project name template to create an eclipse project.
static String getProjectName(String template, IdeDependency dep)
           
static String getProjectName(String template, org.apache.maven.project.MavenProject project)
           
static org.apache.maven.artifact.Artifact resolveArtifactWithClassifier(String groupId, String artifactId, String version, String classifier, org.apache.maven.artifact.repository.ArtifactRepository localRepository, org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver, org.apache.maven.artifact.factory.ArtifactFactory artifactFactory, List remoteRepos, org.apache.maven.plugin.logging.Log log)
           
static String resolveJavaVersion(org.apache.maven.project.MavenProject project)
           
static String toRelativeAndFixSeparator(File basedir, File fileToAdd, boolean replaceSlashesWithDashes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JAVA_1_1

public static final String JAVA_1_1
See Also:
Constant Field Values

JAVA_1_2

public static final String JAVA_1_2
See Also:
Constant Field Values

JAVA_1_3

public static final String JAVA_1_3
See Also:
Constant Field Values

JAVA_1_4

public static final String JAVA_1_4
See Also:
Constant Field Values

JAVA_5_0

public static final String JAVA_5_0
See Also:
Constant Field Values

JAVA_6_0

public static final String JAVA_6_0
See Also:
Constant Field Values

PROJECT_NAME_DEFAULT_TEMPLATE

public static final String PROJECT_NAME_DEFAULT_TEMPLATE
See Also:
Constant Field Values

PROJECT_NAME_WITH_VERSION_TEMPLATE

public static final String PROJECT_NAME_WITH_VERSION_TEMPLATE
See Also:
Constant Field Values

PROJECT_NAME_WITH_GROUP_TEMPLATE

public static final String PROJECT_NAME_WITH_GROUP_TEMPLATE
See Also:
Constant Field Values

PROJECT_NAME_WITH_GROUP_AND_VERSION_TEMPLATE

public static final String PROJECT_NAME_WITH_GROUP_AND_VERSION_TEMPLATE
See Also:
Constant Field Values
Method Detail

getCanonicalPath

public static String getCanonicalPath(File file)
                               throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

getCompilerPluginSetting

public static String getCompilerPluginSetting(org.apache.maven.project.MavenProject project,
                                              String optionName)
Returns a compiler plugin settings, considering also settings altered in plugin executions .

Parameters:
project - maven project
Returns:
option value (may be null)

getCompilerSourceVersion

public static String getCompilerSourceVersion(org.apache.maven.project.MavenProject project)
Returns the source version configured for the compiler plugin. Returns the minimum version required to compile both standard and test sources, if settings are different.

Parameters:
project - maven project
Returns:
java source version

getCompilerTargetVersion

public static String getCompilerTargetVersion(org.apache.maven.project.MavenProject project)
Returns the target version configured for the compiler plugin. Returns the minimum version required to compile both standard and test sources, if settings are different.

Parameters:
project - maven project
Returns:
java target version

getArtifactVersion

public static String getArtifactVersion(String[] artifactIds,
                                        List dependencies,
                                        int len)
Extracts the version of the first matching artifact in the given list.

Parameters:
artifactIds - artifact names to compare against for extracting version
artifacts - Set of artifacts for our project
len - expected length of the version sub-string
Returns:

getPluginSetting

public static String getPluginSetting(org.apache.maven.project.MavenProject project,
                                      String pluginId,
                                      String optionName,
                                      String defaultValue)
Search for a configuration setting of an other plugin for a configuration setting.

Parameters:
project - the current maven project to get the configuration from.
pluginId - the group id and artifact id of the plugin to search for
optionName - the option to get from the configuration
defaultValue - the default value if the configuration was not found
Returns:
the value of the option configured in the plugin configuration

getPluginConfigurationDom

public static org.codehaus.plexus.util.xml.Xpp3Dom getPluginConfigurationDom(org.apache.maven.project.MavenProject project,
                                                                             String pluginId)
Search for the configuration Xpp3 dom of an other plugin.

Parameters:
project - the current maven project to get the configuration from.
pluginId - the group id and artifact id of the plugin to search for
Returns:
the value of the option configured in the plugin configuration

getPluginConfigurationDom

public static org.codehaus.plexus.util.xml.Xpp3Dom[] getPluginConfigurationDom(org.apache.maven.project.MavenProject project,
                                                                               String artifactId,
                                                                               String[] subConfiguration)
Search for the configuration Xpp3 dom of an other plugin.

Parameters:
project - the current maven project to get the configuration from.
artifactId - the artifact id of the plugin to search for
Returns:
the value of the option configured in the plugin configuration

getProjectName

public static String getProjectName(String template,
                                    IdeDependency dep)

getProjectName

public static String getProjectName(String template,
                                    org.apache.maven.artifact.Artifact artifact)
Use the project name template to create an eclipse project.

Parameters:
template - Template for the project name
artifact - the artifact to create the project name for
Returns:
the created ide project name

getProjectName

public static String getProjectName(String template,
                                    org.apache.maven.project.MavenProject project)

getProjectName

public static String getProjectName(IdeDependency dep,
                                    boolean addVersionToProjectName)

getProjectName

public static String getProjectName(org.apache.maven.project.MavenProject project,
                                    boolean addVersionToProjectName)

resolveArtifactWithClassifier

public static org.apache.maven.artifact.Artifact resolveArtifactWithClassifier(String groupId,
                                                                               String artifactId,
                                                                               String version,
                                                                               String classifier,
                                                                               org.apache.maven.artifact.repository.ArtifactRepository localRepository,
                                                                               org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver,
                                                                               org.apache.maven.artifact.factory.ArtifactFactory artifactFactory,
                                                                               List remoteRepos,
                                                                               org.apache.maven.plugin.logging.Log log)

resolveJavaVersion

public static String resolveJavaVersion(org.apache.maven.project.MavenProject project)

toRelativeAndFixSeparator

public static String toRelativeAndFixSeparator(File basedir,
                                               File fileToAdd,
                                               boolean replaceSlashesWithDashes)
                                        throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException


Copyright © 2002-2007 The Apache Software Foundation. All Rights Reserved.