You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kr...@apache.org on 2013/08/27 16:16:57 UTC
svn commit: r1517827 [13/24] - in /maven/plugins/trunk:
maven-acr-plugin/src/main/java/org/apache/maven/plugin/acr/
maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/
maven-ant-plugin/src/test/java/org/apache/maven/plugin/ant/stubs/
maven-antr...
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseOSGiManifestWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseOSGiManifestWriter.java?rev=1517827&r1=1517826&r2=1517827&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseOSGiManifestWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseOSGiManifestWriter.java Tue Aug 27 14:16:42 2013
@@ -37,7 +37,7 @@ import org.codehaus.plexus.util.StringUt
/**
* The <code>EclipseOSGiManifestWriter</code> ensures that value of the "Bundle-Classpath" property in
* META-INF/MANIFEST.MF is synchronized with the POM by adding all dependencies that don't have the scope provided.
- *
+ *
* @deprecated use <a href="http://cwiki.apache.org/FELIX/bundle-plugin-for-maven-bnd.html/">Maven Bundle plugin</a>
* from Felix
*/
@@ -47,7 +47,7 @@ public class EclipseOSGiManifestWriter
/**
* Constant used for newline.
- *
+ *
* @todo check if we should use system-dependent newlines or if eclipse prefers a common format
*/
private static final String NEWLINE = "\n";
@@ -100,13 +100,14 @@ public class EclipseOSGiManifestWriter
}
catch ( FileNotFoundException e )
{
- throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantwritetofile",
- config.getOSGIManifestFile().getAbsolutePath() ) );
+ throw new MojoExecutionException(
+ Messages.getString( "EclipsePlugin.cantwritetofile", config.getOSGIManifestFile().getAbsolutePath() ) );
}
catch ( IOException e )
{
- throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantwritetofile",
- config.getOSGIManifestFile().getAbsolutePath() ), e );
+ throw new MojoExecutionException(
+ Messages.getString( "EclipsePlugin.cantwritetofile", config.getOSGIManifestFile().getAbsolutePath() ),
+ e );
}
finally
{
@@ -128,7 +129,7 @@ public class EclipseOSGiManifestWriter
String line;
while ( ( line = in.readLine() ) != null )
{
- if ( inBundleClasspathEntry && line.contains(":"))
+ if ( inBundleClasspathEntry && line.contains( ":" ) )
{
inBundleClasspathEntry = false;
}
@@ -168,7 +169,8 @@ public class EclipseOSGiManifestWriter
manifestSb.append( getNormalizedVersion( config.getProject().getVersion() ) );
manifestSb.append( NEWLINE );
}
- else if ( name.equalsIgnoreCase( ENTRY_BUNDLE_VENDOR ) && config.getProject().getOrganization() != null )
+ else if ( name.equalsIgnoreCase( ENTRY_BUNDLE_VENDOR )
+ && config.getProject().getOrganization() != null )
{
manifestSb.append( ENTRY_BUNDLE_VENDOR );
manifestSb.append( " " );
@@ -177,7 +179,7 @@ public class EclipseOSGiManifestWriter
}
else
{
- manifestSb.append(line).append(NEWLINE);
+ manifestSb.append( line ).append( NEWLINE );
}
}
@@ -185,8 +187,8 @@ public class EclipseOSGiManifestWriter
}
catch ( IOException e )
{
- throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantreadfile",
- manifestFile.getAbsolutePath() ) );
+ throw new MojoExecutionException(
+ Messages.getString( "EclipsePlugin.cantreadfile", manifestFile.getAbsolutePath() ) );
}
manifestSb.append( addBundleClasspathEntries() );
@@ -198,7 +200,7 @@ public class EclipseOSGiManifestWriter
/**
* Normalize a version number, by moving snapshot identifier to the 5th token (first 4 tokens must be numeric for
* OSGI bundles)
- *
+ *
* @param version original version
* @return a normalized version number
*/
@@ -211,12 +213,12 @@ public class EclipseOSGiManifestWriter
int j = 0;
StringBuilder newVersion = new StringBuilder( 20 );
- for ( ; j < versionTokens.length; j++ )
+ for (; j < versionTokens.length; j++ )
{
newVersion.append( versionTokens[j] );
newVersion.append( "." );
}
- for ( ; j < 3; j++ )
+ for (; j < 3; j++ )
{
newVersion.append( "0." );
}
@@ -230,7 +232,7 @@ public class EclipseOSGiManifestWriter
/**
* Add all libraries that don't have the scope "provided" to the "Bundle-Classpath".
- *
+ *
* @return complete "Bundle-ClassPath:" entry for manifest
*/
protected String addBundleClasspathEntries()
@@ -243,13 +245,15 @@ public class EclipseOSGiManifestWriter
IdeDependency[] deps = config.getDeps();
- for (IdeDependency dep : deps) {
- if (!dep.isProvided() && !dep.isReferencedProject() && !dep.isTestDependency() && !dep.isOsgiBundle()) {
- bundleClasspathSb.append("," + NEWLINE);
+ for ( IdeDependency dep : deps )
+ {
+ if ( !dep.isProvided() && !dep.isReferencedProject() && !dep.isTestDependency() && !dep.isOsgiBundle() )
+ {
+ bundleClasspathSb.append( "," + NEWLINE );
- log.debug("Adding artifact to manifest: " + dep.getArtifactId());
+ log.debug( "Adding artifact to manifest: " + dep.getArtifactId() );
- bundleClasspathSb.append(" ").append(dep.getFile().getName());
+ bundleClasspathSb.append( " " ).append( dep.getFile().getName() );
}
}
// only insert the name of the property if there are local libraries
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java?rev=1517827&r1=1517826&r2=1517827&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java Tue Aug 27 14:16:42 2013
@@ -47,7 +47,7 @@ import org.codehaus.plexus.util.xml.pull
/**
* Writes eclipse .project file.
- *
+ *
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
* @author <a href="mailto:kenney@neonics.com">Kenney Westerhof</a>
* @author <a href="mailto:fgiust@apache.org">Fabrizio Giustina</a>
@@ -118,9 +118,10 @@ public class EclipseProjectWriter
if ( naturesElement != null )
{
Xpp3Dom[] existingNatures = naturesElement.getChildren( ELT_NATURE );
- for (Xpp3Dom existingNature : existingNatures) {
+ for ( Xpp3Dom existingNature : existingNatures )
+ {
// adds all the existing natures
- projectnatures.add(existingNature.getValue());
+ projectnatures.add( existingNature.getValue() );
}
}
@@ -128,10 +129,12 @@ public class EclipseProjectWriter
if ( buildSpec != null )
{
Xpp3Dom[] existingBuildCommands = buildSpec.getChildren( ELT_BUILD_COMMAND );
- for (Xpp3Dom existingBuildCommand : existingBuildCommands) {
- Xpp3Dom buildCommandName = existingBuildCommand.getChild(ELT_NAME);
- if (buildCommandName != null) {
- buildCommands.add(new BuildCommand(existingBuildCommand));
+ for ( Xpp3Dom existingBuildCommand : existingBuildCommands )
+ {
+ Xpp3Dom buildCommandName = existingBuildCommand.getChild( ELT_NAME );
+ if ( buildCommandName != null )
+ {
+ buildCommands.add( new BuildCommand( existingBuildCommand ) );
}
}
}
@@ -140,12 +143,14 @@ public class EclipseProjectWriter
if ( linkedResourcesElement != null )
{
Xpp3Dom[] existingLinks = linkedResourcesElement.getChildren( ELT_LINK );
- for (Xpp3Dom existingLink : existingLinks) {
- Xpp3Dom linkName = existingLink.getChild(ELT_NAME);
- if (linkName != null) {
+ for ( Xpp3Dom existingLink : existingLinks )
+ {
+ Xpp3Dom linkName = existingLink.getChild( ELT_NAME );
+ if ( linkName != null )
+ {
// add all the existing symbolic links
- linkNames.add(existingLink.getChild(ELT_NAME).getValue());
- linkedResources.add(new LinkedResource(existingLink));
+ linkNames.add( existingLink.getChild( ELT_NAME ).getValue() );
+ linkedResources.add( new LinkedResource( existingLink ) );
}
}
}
@@ -153,11 +158,13 @@ public class EclipseProjectWriter
}
catch ( XmlPullParserException e )
{
- log.warn( Messages.getString( "EclipsePlugin.cantparseexisting", dotProject.getAbsolutePath() ) ); //$NON-NLS-1$
+ log.warn( Messages.getString( "EclipsePlugin.cantparseexisting",
+ dotProject.getAbsolutePath() ) ); //$NON-NLS-1$
}
catch ( IOException e )
{
- log.warn( Messages.getString( "EclipsePlugin.cantparseexisting", dotProject.getAbsolutePath() ) ); //$NON-NLS-1$
+ log.warn( Messages.getString( "EclipsePlugin.cantparseexisting",
+ dotProject.getAbsolutePath() ) ); //$NON-NLS-1$
}
finally
{
@@ -166,16 +173,19 @@ public class EclipseProjectWriter
}
// adds new entries after the existing ones
- for (Object o2 : config.getProjectnatures()) {
- projectnatures.add(o2);
+ for ( Object o2 : config.getProjectnatures() )
+ {
+ projectnatures.add( o2 );
}
- for (Object o1 : config.getBuildCommands()) {
- buildCommands.add(o1);
+ for ( Object o1 : config.getBuildCommands() )
+ {
+ buildCommands.add( o1 );
}
- for (Object o : config.getLinkedResources()) {
- linkedResources.add(o);
+ for ( Object o : config.getLinkedResources() )
+ {
+ linkedResources.add( o );
}
Writer w;
@@ -186,7 +196,8 @@ public class EclipseProjectWriter
}
catch ( IOException ex )
{
- throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); //$NON-NLS-1$
+ throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ),
+ ex ); //$NON-NLS-1$
}
XMLWriter writer = new PrettyPrintXMLWriter( w, "UTF-8", null );
@@ -202,19 +213,21 @@ public class EclipseProjectWriter
writer.startElement( "projects" ); //$NON-NLS-1$
IdeDependency[] dependencies = config.getDeps();
-
+
// referenced projects should not be added for plugins
if ( !config.isPde() )
{
List duplicates = new ArrayList();
- for (IdeDependency dep : dependencies) {
+ for ( IdeDependency dep : dependencies )
+ {
// Avoid duplicates entries when same project is refered using multiple types
// (ejb, test-jar ...)
- if (dep.isReferencedProject() && !duplicates.contains(dep.getEclipseProjectName())) {
- writer.startElement("project"); //$NON-NLS-1$
- writer.writeText(dep.getEclipseProjectName());
+ if ( dep.isReferencedProject() && !duplicates.contains( dep.getEclipseProjectName() ) )
+ {
+ writer.startElement( "project" ); //$NON-NLS-1$
+ writer.writeText( dep.getEclipseProjectName() );
writer.endElement();
- duplicates.add(dep.getEclipseProjectName());
+ duplicates.add( dep.getEclipseProjectName() );
}
}
}
@@ -223,17 +236,19 @@ public class EclipseProjectWriter
writer.startElement( ELT_BUILD_SPEC );
- for (Object buildCommand : buildCommands) {
- ((BuildCommand) buildCommand).print(writer);
+ for ( Object buildCommand : buildCommands )
+ {
+ ( (BuildCommand) buildCommand ).print( writer );
}
writer.endElement(); // buildSpec
writer.startElement( ELT_NATURES );
- for (Object projectnature : projectnatures) {
- writer.startElement(ELT_NATURE);
- writer.writeText((String) projectnature);
+ for ( Object projectnature : projectnatures )
+ {
+ writer.startElement( ELT_NATURE );
+ writer.writeText( (String) projectnature );
writer.endElement(); // name
}
@@ -247,8 +262,9 @@ public class EclipseProjectWriter
// preserve the symbolic links
if ( linkedResources.size() > 0 )
{
- for (Object linkedResource : linkedResources) {
- ((LinkedResource) linkedResource).print(writer);
+ for ( Object linkedResource : linkedResources )
+ {
+ ( (LinkedResource) linkedResource ).print( writer );
}
}
@@ -272,12 +288,14 @@ public class EclipseProjectWriter
if ( config.isPde() )
{
- for (IdeDependency dep : dependencies) {
- if (dep.isAddedToClasspath() && !dep.isProvided() && !dep.isReferencedProject()
- && !dep.isTestDependency() && !dep.isOsgiBundle()) {
+ for ( IdeDependency dep : dependencies )
+ {
+ if ( dep.isAddedToClasspath() && !dep.isProvided() && !dep.isReferencedProject()
+ && !dep.isTestDependency() && !dep.isOsgiBundle() )
+ {
String name = dep.getFile().getName();
- addLink(writer, name, IdeUtils.fixSeparator(IdeUtils.getCanonicalPath(dep.getFile())),
- LINK_TYPE_FILE);
+ addLink( writer, name, IdeUtils.fixSeparator( IdeUtils.getCanonicalPath( dep.getFile() ) ),
+ LINK_TYPE_FILE );
}
}
}
@@ -309,15 +327,17 @@ public class EclipseProjectWriter
private void addSourceLinks( XMLWriter writer, File projectBaseDir, File basedir, List sourceRoots )
throws MojoExecutionException
{
- for (Object sourceRoot1 : sourceRoots) {
+ for ( Object sourceRoot1 : sourceRoots )
+ {
String sourceRootString = (String) sourceRoot1;
- File sourceRoot = new File(sourceRootString);
+ File sourceRoot = new File( sourceRootString );
- if (sourceRoot.isDirectory()) {
- String name = IdeUtils.toRelativeAndFixSeparator(projectBaseDir, sourceRoot, true);
- String location = IdeUtils.fixSeparator(IdeUtils.getCanonicalPath(sourceRoot));
+ if ( sourceRoot.isDirectory() )
+ {
+ String name = IdeUtils.toRelativeAndFixSeparator( projectBaseDir, sourceRoot, true );
+ String location = IdeUtils.fixSeparator( IdeUtils.getCanonicalPath( sourceRoot ) );
- addLink(writer, name, location, LINK_TYPE_DIRECTORY);
+ addLink( writer, name, location, LINK_TYPE_DIRECTORY );
}
}
}
@@ -325,15 +345,17 @@ public class EclipseProjectWriter
private void addResourceLinks( XMLWriter writer, File projectBaseDir, File basedir, List sourceRoots )
throws MojoExecutionException
{
- for (Object sourceRoot : sourceRoots) {
- String resourceDirString = ((Resource) sourceRoot).getDirectory();
- File resourceDir = new File(resourceDirString);
-
- if (resourceDir.isDirectory()) {
- String name = IdeUtils.toRelativeAndFixSeparator(projectBaseDir, resourceDir, true);
- String location = IdeUtils.fixSeparator(IdeUtils.getCanonicalPath(resourceDir));
+ for ( Object sourceRoot : sourceRoots )
+ {
+ String resourceDirString = ( (Resource) sourceRoot ).getDirectory();
+ File resourceDir = new File( resourceDirString );
+
+ if ( resourceDir.isDirectory() )
+ {
+ String name = IdeUtils.toRelativeAndFixSeparator( projectBaseDir, resourceDir, true );
+ String location = IdeUtils.fixSeparator( IdeUtils.getCanonicalPath( resourceDir ) );
- addLink(writer, name, location, LINK_TYPE_DIRECTORY);
+ addLink( writer, name, location, LINK_TYPE_DIRECTORY );
}
}
}
@@ -390,7 +412,8 @@ public class EclipseProjectWriter
//
// Project files that are generated with m-p-e cannot be supported by M2Eclipse
//
- comment += "NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.";
+ comment +=
+ "NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.";
writer.startElement( ELT_COMMENT );
writer.writeText( comment );
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/myeclipse/MyEclipseHibernateWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/myeclipse/MyEclipseHibernateWriter.java?rev=1517827&r1=1517826&r2=1517827&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/myeclipse/MyEclipseHibernateWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/myeclipse/MyEclipseHibernateWriter.java Tue Aug 27 14:16:42 2013
@@ -14,7 +14,7 @@ import org.codehaus.plexus.util.IOUtil;
/**
* Writer for MyEclipse Hibernate Capability
- *
+ *
* @author <a href="mailto:olivier.jacob@gmail.com">Olivier Jacob</a>
*/
public class MyEclipseHibernateWriter
@@ -72,7 +72,7 @@ public class MyEclipseHibernateWriter
/**
* Constructor
- *
+ *
* @param hibernateConfig path to the configuration file to use
*/
public MyEclipseHibernateWriter( Map hibernateConfig )
@@ -82,7 +82,7 @@ public class MyEclipseHibernateWriter
/**
* Write MyEclipse Hibernate configuration
- *
+ *
* @throws MojoExecutionException if an error occurs
*/
public void write()
@@ -96,7 +96,8 @@ public class MyEclipseHibernateWriter
}
catch ( IOException ex )
{
- throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); //$NON-NLS-1$
+ throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ),
+ ex ); //$NON-NLS-1$
}
PrintWriter pw = new PrintWriter( w );
@@ -130,9 +131,9 @@ public class MyEclipseHibernateWriter
/**
* Writes a configuration property to the PrintWriter given in parameter
- *
- * @param pw the PrintWriter to write to
- * @param propName the property name
+ *
+ * @param pw the PrintWriter to write to
+ * @param propName the property name
* @param propValue the property value (writes empty String if null)
*/
private void addProperty( PrintWriter pw, String propName, String propValue )
@@ -151,20 +152,20 @@ public class MyEclipseHibernateWriter
/**
* Find Hibernate version in project dependencies
- *
+ *
* @return the version of the hibernate artifact if found in the dependencies or 3.2 (default value)
*/
private String getHibernateVersion()
{
String version =
- IdeUtils.getArtifactVersion( new String[] { "hibernate" }, config.getProject().getDependencies(), 3 );
+ IdeUtils.getArtifactVersion( new String[]{ "hibernate" }, config.getProject().getDependencies(), 3 );
return version != null ? version : "3.2";
}
/**
* Prepend the project artifactId to the path given in the plugin configuration
- *
+ *
* @return the path to the file relative to the root of the Eclipse Workspace
*/
private String makePathToHibernateConfigFile( String configFile )
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/myeclipse/MyEclipseSpringBeansWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/myeclipse/MyEclipseSpringBeansWriter.java?rev=1517827&r1=1517826&r2=1517827&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/myeclipse/MyEclipseSpringBeansWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/myeclipse/MyEclipseSpringBeansWriter.java Tue Aug 27 14:16:42 2013
@@ -20,7 +20,7 @@ import org.codehaus.plexus.util.xml.XMLW
/**
* MyEclipse .springBeans configuration file writer
- *
+ *
* @author Olivier Jacob
*/
public class MyEclipseSpringBeansWriter
@@ -49,7 +49,7 @@ public class MyEclipseSpringBeansWriter
/**
* Allow injection of Spring configuration filenames through constructor
- *
+ *
* @param springConfig a map holding Spring configuration properties
*/
public MyEclipseSpringBeansWriter( Map springConfig )
@@ -59,7 +59,7 @@ public class MyEclipseSpringBeansWriter
/**
* Write MyEclipse .springBeans configuration file
- *
+ *
* @throws MojoExecutionException
*/
public void write()
@@ -68,12 +68,13 @@ public class MyEclipseSpringBeansWriter
FileWriter springFileWriter;
try
{
- springFileWriter =
- new FileWriter( new File( config.getEclipseProjectDirectory(), MYECLIPSE_SPRING_CONFIGURATION_FILENAME ) );
+ springFileWriter = new FileWriter(
+ new File( config.getEclipseProjectDirectory(), MYECLIPSE_SPRING_CONFIGURATION_FILENAME ) );
}
catch ( IOException ex )
{
- throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); //$NON-NLS-1$
+ throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ),
+ ex ); //$NON-NLS-1$
}
XMLWriter writer = new PrettyPrintXMLWriter( springFileWriter, "UTF-8", null );
@@ -93,14 +94,15 @@ public class MyEclipseSpringBeansWriter
// do this with full path so it works as we descend through various modules (projects)
File basedir = config.getEclipseProjectDirectory();
- for (Object o : getConfigurationFilesList(new File(basedir, (String) springConfig.get("basedir")),
- (String) springConfig.get("file-pattern"))) {
+ for ( Object o : getConfigurationFilesList( new File( basedir, (String) springConfig.get( "basedir" ) ),
+ (String) springConfig.get( "file-pattern" ) ) )
+ {
String onConfigFileName = (String) o;
- File onConfigFile = new File(onConfigFileName);
- String relativeFileName = IdeUtils.toRelativeAndFixSeparator(basedir, onConfigFile, false);
+ File onConfigFile = new File( onConfigFileName );
+ String relativeFileName = IdeUtils.toRelativeAndFixSeparator( basedir, onConfigFile, false );
- writer.startElement(MYECLIPSE_SPRING_CONFIG);
- writer.writeText(relativeFileName);
+ writer.startElement( MYECLIPSE_SPRING_CONFIG );
+ writer.writeText( relativeFileName );
writer.endElement();
}
writer.endElement();
@@ -122,7 +124,7 @@ public class MyEclipseSpringBeansWriter
/**
* Retrieve the list of Spring configuration files recursively from the <code>basedir</code> directory, considering
* only filenames matching the <code>pattern</code> given
- *
+ *
* @param basedir the path to the base directory to search in
* @param pattern file include pattern
* @return the list of filenames matching the given pattern
@@ -146,8 +148,9 @@ public class MyEclipseSpringBeansWriter
if ( subdirs != null )
{
- for (File subdir : subdirs) {
- configFiles.addAll(getConfigurationFilesList(subdir, pattern));
+ for ( File subdir : subdirs )
+ {
+ configFiles.addAll( getConfigurationFilesList( subdir, pattern ) );
}
}
@@ -157,8 +160,8 @@ public class MyEclipseSpringBeansWriter
{
// This isn't fatal because sometimes we run this in a nested set of
// projects where some of the projects may not have spring configuration
- log.warn( Messages.getString( "MyEclipseSpringBeansWriter.baseDirDoesNotExist",
- new Object[] { basedir } ) );
+ log.warn(
+ Messages.getString( "MyEclipseSpringBeansWriter.baseDirDoesNotExist", new Object[]{ basedir } ) );
}
}
catch ( IOException ioe )
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadApplicationXMLWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadApplicationXMLWriter.java?rev=1517827&r1=1517826&r2=1517827&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadApplicationXMLWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadApplicationXMLWriter.java Tue Aug 27 14:16:42 2013
@@ -49,7 +49,7 @@ import org.codehaus.plexus.util.xml.Xpp3
* This writer creates the application.xml and the .modulemaps files for RAD6 in the META-INF directory in the project
* root. this is where RAD6 requires the files to be. These will be independent of the real application.xml witch will
* be generated the stad. maven way.
- *
+ *
* @author <a href="mailto:nir@cfc.at">Richard van Nieuwenhoven </a>
*/
public class RadApplicationXMLWriter
@@ -122,12 +122,12 @@ public class RadApplicationXMLWriter
/**
* write the application.xml and the .modulemaps file to the META-INF directory.
- *
- * @see AbstractWtpResourceWriter#write(EclipseSourceDir[], ArtifactRepository, File)
- * @param sourceDirs all eclipse source directorys
- * @param localRepository the local reposetory
+ *
+ * @param sourceDirs all eclipse source directorys
+ * @param localRepository the local reposetory
* @param buildOutputDirectory build output directory (target)
* @throws MojoExecutionException when writing the config files was not possible
+ * @see AbstractWtpResourceWriter#write(EclipseSourceDir[], ArtifactRepository, File)
*/
public void write()
throws MojoExecutionException
@@ -155,11 +155,12 @@ public class RadApplicationXMLWriter
this.webModulesFromPoms =
IdeUtils.getPluginConfigurationDom( config.getProject(), JeeUtils.ARTIFACT_MAVEN_EAR_PLUGIN,
- new String[] { "modules", "webModule" } );
+ new String[]{ "modules", "webModule" } );
IdeDependency[] deps = config.getDeps();
- for (IdeDependency dep : deps) {
- updateApplicationXml(applicationXmlDom, modulemapsXmlDom, dep);
+ for ( IdeDependency dep : deps )
+ {
+ updateApplicationXml( applicationXmlDom, modulemapsXmlDom, dep );
}
removeUnusedEntries( applicationXmlDom, modulemapsXmlDom );
@@ -171,7 +172,7 @@ public class RadApplicationXMLWriter
/**
* there is no existing application.xml file so create a new one.
- *
+ *
* @return the domtree representing the contents of application.xml
*/
private Xpp3Dom createNewApplicationXml()
@@ -204,7 +205,7 @@ public class RadApplicationXMLWriter
/**
* there is no existing .modulemaps file so create a new one.
- *
+ *
* @return the domtree representing the contents of the .modulemaps file
*/
private Xpp3Dom createNewModulemaps()
@@ -221,18 +222,20 @@ public class RadApplicationXMLWriter
/**
* find an existing module entry in the application.xml file by looking up the id in the modulemaps file and then
* using that to locate the entry in the application.xml file.
- *
+ *
* @param applicationXmlDom application.xml dom tree
- * @param mapping .modulemaps dom tree
+ * @param mapping .modulemaps dom tree
* @return dom tree representing the module
*/
private Xpp3Dom findModuleInApplicationXml( Xpp3Dom applicationXmlDom, Xpp3Dom mapping )
{
String id = getIdFromMapping( mapping );
Xpp3Dom[] children = applicationXmlDom.getChildren();
- for (Xpp3Dom aChildren : children) {
- String childId = aChildren.getAttribute(ID);
- if (childId != null && childId.equals(id)) {
+ for ( Xpp3Dom aChildren : children )
+ {
+ String childId = aChildren.getAttribute( ID );
+ if ( childId != null && childId.equals( id ) )
+ {
return aChildren;
}
}
@@ -241,8 +244,8 @@ public class RadApplicationXMLWriter
/**
* find an artifact in the modulemaps dom tree, if it is missing create a new entry in the modulemaps dom tree.
- *
- * @param dependency dependency to find
+ *
+ * @param dependency dependency to find
* @param modulemapXmlDom dom-tree of modulemaps
* @return dom-tree representing the artifact
*/
@@ -254,17 +257,15 @@ public class RadApplicationXMLWriter
{
if ( children[index].getAttribute( MODULEMAPS_PROJECT_NAME ).equals( dependency.getArtifactId() ) )
{
- if ( dependency.getType().equals( Constants.PROJECT_PACKAGING_EJB )
- && children[index].getName().equals( MODULEMAPS_MAPPINGS )
- && children[index].getChild( APPLICATION_XML_MODULE ).getAttribute( XMI_TYPE ).equals(
- MODULEMAPS_APPLICATION_EJB_MODULE ) )
+ if ( dependency.getType().equals( Constants.PROJECT_PACKAGING_EJB ) && children[index].getName().equals(
+ MODULEMAPS_MAPPINGS ) && children[index].getChild( APPLICATION_XML_MODULE ).getAttribute(
+ XMI_TYPE ).equals( MODULEMAPS_APPLICATION_EJB_MODULE ) )
{
return children[index];
}
else if ( dependency.getType().equals( Constants.PROJECT_PACKAGING_WAR )
- && children[index].getName().equals( MODULEMAPS_MAPPINGS )
- && children[index].getChild( APPLICATION_XML_MODULE ).getAttribute( XMI_TYPE ).equals(
- MODULEMAPS_APPLICATION_WEB_MODULE ) )
+ && children[index].getName().equals( MODULEMAPS_MAPPINGS ) && children[index].getChild(
+ APPLICATION_XML_MODULE ).getAttribute( XMI_TYPE ).equals( MODULEMAPS_APPLICATION_WEB_MODULE ) )
{
return children[index];
}
@@ -320,7 +321,7 @@ public class RadApplicationXMLWriter
/**
* get the id from the href of a modulemap.
- *
+ *
* @param mapping the dom-tree of modulemaps
* @return module identifier
*/
@@ -337,7 +338,7 @@ public class RadApplicationXMLWriter
/**
* mark the domtree entry as handled (all not handled ones will be deleted).
- *
+ *
* @param xpp3Dom dom element to mark handled
*/
private void handled( Xpp3Dom xpp3Dom )
@@ -360,7 +361,7 @@ public class RadApplicationXMLWriter
/**
* read an xml file (application.xml or .modulemaps).
- *
+ *
* @param xmlFile an xmlfile
* @return dom-tree representing the file contents
*/
@@ -386,30 +387,38 @@ public class RadApplicationXMLWriter
/**
* delete all unused entries from the dom-trees.
- *
+ *
* @param applicationXmlDom dom-tree of application.xml
- * @param modulemapsXmlDom dom-tree of modulemaps
+ * @param modulemapsXmlDom dom-tree of modulemaps
*/
private void removeUnusedEntries( Xpp3Dom applicationXmlDom, Xpp3Dom modulemapsXmlDom )
{
- for (Xpp3Dom aModulemapsXmlDomChildren : this.modulemapsXmlDomChildren) {
- if (aModulemapsXmlDomChildren != null) {
+ for ( Xpp3Dom aModulemapsXmlDomChildren : this.modulemapsXmlDomChildren )
+ {
+ if ( aModulemapsXmlDomChildren != null )
+ {
Xpp3Dom[] newModulemapsXmlDomChildren = modulemapsXmlDom.getChildren();
- for (int newIndex = 0; newIndex < newModulemapsXmlDomChildren.length; newIndex++) {
- if ((newModulemapsXmlDomChildren[newIndex] != null)
- && (newModulemapsXmlDomChildren[newIndex] == aModulemapsXmlDomChildren)) {
- modulemapsXmlDom.removeChild(newIndex);
+ for ( int newIndex = 0; newIndex < newModulemapsXmlDomChildren.length; newIndex++ )
+ {
+ if ( ( newModulemapsXmlDomChildren[newIndex] != null ) && ( newModulemapsXmlDomChildren[newIndex]
+ == aModulemapsXmlDomChildren ) )
+ {
+ modulemapsXmlDom.removeChild( newIndex );
break;
}
}
}
}
- for (Xpp3Dom anApplicationXmlDomChildren : this.applicationXmlDomChildren) {
- if (anApplicationXmlDomChildren != null) {
+ for ( Xpp3Dom anApplicationXmlDomChildren : this.applicationXmlDomChildren )
+ {
+ if ( anApplicationXmlDomChildren != null )
+ {
Xpp3Dom[] newApplicationXmlDomChildren = applicationXmlDom.getChildren();
- for (int newIndex = 0; newIndex < newApplicationXmlDomChildren.length; newIndex++) {
- if (newApplicationXmlDomChildren[newIndex] == anApplicationXmlDomChildren) {
- applicationXmlDom.removeChild(newIndex);
+ for ( int newIndex = 0; newIndex < newApplicationXmlDomChildren.length; newIndex++ )
+ {
+ if ( newApplicationXmlDomChildren[newIndex] == anApplicationXmlDomChildren )
+ {
+ applicationXmlDom.removeChild( newIndex );
break;
}
}
@@ -421,10 +430,10 @@ public class RadApplicationXMLWriter
* update the application.xml and the .modulemaps file for a specified dependency.all WAR an EJB dependencies will
* go in both files all others only in the modulemaps files. Webapplications contextroots are corrected to the
* contextRoot specified in the pom.
- *
+ *
* @param applicationXmlDom dom-tree of application.xml
- * @param modulemapXmlDom dom-tree of modulemaps
- * @param dependency the eclipse dependency to handle
+ * @param modulemapXmlDom dom-tree of modulemaps
+ * @param dependency the eclipse dependency to handle
*/
private void updateApplicationXml( Xpp3Dom applicationXmlDom, Xpp3Dom modulemapXmlDom, IdeDependency dependency )
{
@@ -475,10 +484,9 @@ public class RadApplicationXMLWriter
{
handled( module );
module.getChild( APPLICATION_XML_WEB ).getChild( APPLICATION_XML_WEB_URI ).setValue(
- dependency.getArtifactId()
- + ".war" );
+ dependency.getArtifactId() + ".war" );
module.getChild( APPLICATION_XML_WEB ).getChild( APPLICATION_XML_CONTEXT_ROOT ).setValue(
- contextRootInPom );
+ contextRootInPom );
}
}
}
@@ -486,23 +494,26 @@ public class RadApplicationXMLWriter
/**
* Find the contextRoot specified in the pom and convert it into contextroot for the application.xml.
- *
+ *
* @param artifactId the artifactid to search
* @return string with the context root
*/
private String getContextRootFor( String artifactId )
{
- for (Xpp3Dom webModulesFromPom : webModulesFromPoms) {
- if (webModulesFromPom.getChild("artifactId").getValue().equals(artifactId))
- return new File(webModulesFromPom.getChild("contextRoot").getValue()).getName();
+ for ( Xpp3Dom webModulesFromPom : webModulesFromPoms )
+ {
+ if ( webModulesFromPom.getChild( "artifactId" ).getValue().equals( artifactId ) )
+ {
+ return new File( webModulesFromPom.getChild( "contextRoot" ).getValue() ).getName();
+ }
}
return artifactId;
}
/**
* write back a domtree to a xmlfile and use the pretty print for it so that it is human readable.
- *
- * @param xmlFile file to write to
+ *
+ * @param xmlFile file to write to
* @param xmlDomTree dom-tree to write
* @throws MojoExecutionException if the file could not be written
*/
@@ -523,7 +534,8 @@ public class RadApplicationXMLWriter
}
catch ( IOException ex )
{
- throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); //$NON-NLS-1$
+ throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ),
+ ex ); //$NON-NLS-1$
}
XMLWriter writer = new PrettyPrintXMLWriter( w, "UTF-8", null );
Xpp3DomWriter.write( writer, xmlDomTree );
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadEjbClasspathWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadEjbClasspathWriter.java?rev=1517827&r1=1517826&r2=1517827&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadEjbClasspathWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadEjbClasspathWriter.java Tue Aug 27 14:16:42 2013
@@ -47,7 +47,7 @@ import org.codehaus.plexus.util.xml.Xpp3
/**
* Adapts the .classpath file for RAD6 for now write hardcoded: target/websphere/classes future releases could make this
* varriable.
- *
+ *
* @author <a href="mailto:nir@cfc.at">Richard van Nieuwenhoven </a>
*/
public class RadEjbClasspathWriter
@@ -81,12 +81,12 @@ public class RadEjbClasspathWriter
/**
* write the .classpath file to the project root directory.
- *
- * @see AbstractWtpResourceWriter#write(EclipseSourceDir[], ArtifactRepository, File)
- * @param sourceDirs all eclipse source directorys
- * @param localRepository the local reposetory
+ *
+ * @param sourceDirs all eclipse source directorys
+ * @param localRepository the local reposetory
* @param buildOutputDirectory build output directory (target)
* @throws MojoExecutionException when writing the config files was not possible
+ * @see AbstractWtpResourceWriter#write(EclipseSourceDir[], ArtifactRepository, File)
*/
public void write()
throws MojoExecutionException
@@ -103,9 +103,11 @@ public class RadEjbClasspathWriter
}
Xpp3Dom classpath = readXMLFile( classpathFile );
Xpp3Dom[] children = classpath.getChildren();
- for (Xpp3Dom aChildren : children) {
- if (LIB.equals(aChildren.getAttribute(KIND))
- && TARGET_WEBSPHERE_CLASSES.equals(aChildren.getAttribute("path"))) {
+ for ( Xpp3Dom aChildren : children )
+ {
+ if ( LIB.equals( aChildren.getAttribute( KIND ) ) && TARGET_WEBSPHERE_CLASSES.equals(
+ aChildren.getAttribute( "path" ) ) )
+ {
return; // nothing to do!
}
}
@@ -139,7 +141,8 @@ public class RadEjbClasspathWriter
}
catch ( IOException ex )
{
- throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); //$NON-NLS-1$
+ throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ),
+ ex ); //$NON-NLS-1$
}
XMLWriter writer = new PrettyPrintXMLWriter( w, "UTF-8", null );
Xpp3DomWriter.write( writer, classpath );
@@ -149,7 +152,7 @@ public class RadEjbClasspathWriter
/**
* determinate of witch type this classpath entry is. this is used for sorting them.
- *
+ *
* @param classpathentry the classpath entry to sort
* @return an integer identifieing the type
* @see RadEjbClasspathWriter#orderClasspath(Xpp3Dom)
@@ -202,7 +205,7 @@ public class RadEjbClasspathWriter
* Order of classpath this is nessesary for the ejb's the generated classes are elsewise not found. 1 - kind=src
* ohne starting '/' oder '\' 2 - kind=lib kein ':' und kein start mit '/' oder '\' 3 - kind=src mit ohne starting
* '/' oder '\' 4 - kind=var 5 - kind=lib ein ':' oder start mit '/' oder '\' 6 - rest 7 - kind=output
- *
+ *
* @param classpath the classpath to sort
* @return dom-tree representing ordered classpath
*/
@@ -217,15 +220,16 @@ public class RadEjbClasspathWriter
}
} );
Xpp3Dom resultClasspath = new Xpp3Dom( CLASSPATH );
- for (Xpp3Dom aChildren : children) {
- resultClasspath.addChild(aChildren);
+ for ( Xpp3Dom aChildren : children )
+ {
+ resultClasspath.addChild( aChildren );
}
return resultClasspath;
}
/**
* read an xml file (application.xml or .modulemaps).
- *
+ *
* @param xmlFile an xmlfile
* @return dom-tree representing the file contents
*/
@@ -251,7 +255,7 @@ public class RadEjbClasspathWriter
/**
* Losche alle pfade die nach was6 zeigen diese sind erkennbar an den parrent runtimes/base_v6/lib.
- *
+ *
* @param classpath classpath to remove was6 libraries
*/
private void removeDupicateWAS6Libs( Xpp3Dom classpath )
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadLibCopier.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadLibCopier.java?rev=1517827&r1=1517826&r2=1517827&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadLibCopier.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadLibCopier.java Tue Aug 27 14:16:42 2013
@@ -35,7 +35,7 @@ import org.codehaus.plexus.util.FileUtil
/**
* Copy all dependent jar in the directorys where RAD6 needs then to use the runtime enviorment in RAD6. so all
* dependent jars in the EAR rootdirectory and all dependend jars in the WAR WEB-INF/lib directory
- *
+ *
* @author <a href="mailto:nir@cfc.at">Richard van Nieuwenhoven</a>
*/
public class RadLibCopier
@@ -44,7 +44,7 @@ public class RadLibCopier
/**
* copy the jars in the apropreate directorys.
- *
+ *
* @throws MojoExecutionException when writing the config files was not possible
*/
public void write()
@@ -66,8 +66,8 @@ public class RadLibCopier
/**
* Copies the Artifact after building the destination file name if overridden. This method also checks if the
* classifier is set and adds it to the destination file name if needed.
- *
- * @param deps representing the dependencies to be copied.
+ *
+ * @param deps representing the dependencies to be copied.
* @param destDir where should the atifact go.
* @throws MojoExecutionException with a message if an error occurs.
* @see DependencyUtil#copyFile(File, File, Log)
@@ -76,28 +76,30 @@ public class RadLibCopier
private void copyArtifact( IdeDependency[] deps, File destDir )
throws MojoExecutionException
{
- String[] oldFiles =
- FileUtils.getFilesFromExtension( destDir.getAbsolutePath(),
- new String[] { Constants.PROJECT_PACKAGING_JAR } );
- for (String oldFile : oldFiles) {
- if (!new File(oldFile).delete()) {
- log.error(Messages.getString("Rad6LibCopier.cantdeletefile", new Object[]{oldFile}));
+ String[] oldFiles = FileUtils.getFilesFromExtension( destDir.getAbsolutePath(),
+ new String[]{ Constants.PROJECT_PACKAGING_JAR } );
+ for ( String oldFile : oldFiles )
+ {
+ if ( !new File( oldFile ).delete() )
+ {
+ log.error( Messages.getString( "Rad6LibCopier.cantdeletefile", new Object[]{ oldFile } ) );
}
}
- for (IdeDependency dep : deps) {
- if (!dep.isTestDependency() && !dep.isProvided() && !dep.isReferencedProject()
- && !dep.isSystemScoped()) {
- copyFile(dep.getFile(), new File(destDir, dep.getFile().getName()), log);
+ for ( IdeDependency dep : deps )
+ {
+ if ( !dep.isTestDependency() && !dep.isProvided() && !dep.isReferencedProject() && !dep.isSystemScoped() )
+ {
+ copyFile( dep.getFile(), new File( destDir, dep.getFile().getName() ), log );
}
}
}
/**
* Does the actual copy of the file and logging.
- *
+ *
* @param artifact represents the file to copy.
* @param destFile file name of destination file.
- * @param log to use for output.
+ * @param log to use for output.
* @throws MojoExecutionException with a message if an error occurs.
*/
private void copyFile( File artifact, File destFile, Log log )
@@ -116,7 +118,7 @@ public class RadLibCopier
/**
* EARs need the jars in the root directory.
- *
+ *
* @param deps dependencys to include
* @throws MojoExecutionException if the copying fails
*/
@@ -129,7 +131,7 @@ public class RadLibCopier
/**
* WARs need the jars in the WEB-INF/lib directory.
- *
+ *
* @param deps dependencys to include
* @throws MojoExecutionException if the copying fails
*/
@@ -139,10 +141,10 @@ public class RadLibCopier
File basedir = config.getProject().getBasedir();
// Generating web content settings based on war plug-in warSourceDirectory property
- File warSourceDirectory =
- new File( IdeUtils.getPluginSetting( config.getProject(), JeeUtils.ARTIFACT_MAVEN_WAR_PLUGIN,
- "warSourceDirectory", //$NON-NLS-1$
- "src/main/webapp" ) ); //$NON-NLS-1$
+ File warSourceDirectory = new File(
+ IdeUtils.getPluginSetting( config.getProject(), JeeUtils.ARTIFACT_MAVEN_WAR_PLUGIN, "warSourceDirectory",
+ //$NON-NLS-1$
+ "src/main/webapp" ) ); //$NON-NLS-1$
String webContentDir =
IdeUtils.toRelativeAndFixSeparator( config.getEclipseProjectDirectory(), warSourceDirectory, false );
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadManifestWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadManifestWriter.java?rev=1517827&r1=1517826&r2=1517827&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadManifestWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadManifestWriter.java Tue Aug 27 14:16:42 2013
@@ -34,7 +34,7 @@ import org.apache.maven.project.MavenPro
* ear these are just to get the runtime enviorment using the maven dependencies. WARNING: The manifest resources added
* here will not have the benefit of the dependencies of the project, since that's not provided in the setup() apis, one
* of the locations from which this writer is used in the RadPlugin.
- *
+ *
* @author <a href="mailto:nir@cfc.at">Richard van Nieuwenhoven </a>
*/
public class RadManifestWriter
@@ -46,7 +46,7 @@ public class RadManifestWriter
/**
* Search the project for the existing META-INF directory where the manifest should be located.
- *
+ *
* @return the apsolute path to the META-INF directory
* @throws MojoExecutionException
*/
@@ -58,10 +58,10 @@ public class RadManifestWriter
if ( config.getProject().getPackaging().equals( Constants.PROJECT_PACKAGING_WAR ) )
{
// Generating web content settings based on war plug-in warSourceDirectory property
- File warSourceDirectory =
- new File( IdeUtils.getPluginSetting( config.getProject(), JeeUtils.ARTIFACT_MAVEN_WAR_PLUGIN,
- "warSourceDirectory", //$NON-NLS-1$
- DEFAULT_WEBAPP_RESOURCE_DIR ) );
+ File warSourceDirectory = new File(
+ IdeUtils.getPluginSetting( config.getProject(), JeeUtils.ARTIFACT_MAVEN_WAR_PLUGIN,
+ "warSourceDirectory", //$NON-NLS-1$
+ DEFAULT_WEBAPP_RESOURCE_DIR ) );
String webContentDir =
IdeUtils.toRelativeAndFixSeparator( config.getEclipseProjectDirectory(), warSourceDirectory, false );
@@ -81,14 +81,16 @@ public class RadManifestWriter
if ( metaInfBaseDirectory == null )
{
- for (Object o : project.getResources()) {
- metaInfBaseDirectory = ((Resource) o).getDirectory();
+ for ( Object o : project.getResources() )
+ {
+ metaInfBaseDirectory = ( (Resource) o ).getDirectory();
- File metaInfDirectoryFile = new File(metaInfBaseDirectory + File.separatorChar + META_INF_DIRECTORY);
+ File metaInfDirectoryFile = new File( metaInfBaseDirectory + File.separatorChar + META_INF_DIRECTORY );
- log.debug("Checking for existence of META-INF directory: " + metaInfDirectoryFile);
+ log.debug( "Checking for existence of META-INF directory: " + metaInfDirectoryFile );
- if (metaInfDirectoryFile.exists() && !metaInfDirectoryFile.isDirectory()) {
+ if ( metaInfDirectoryFile.exists() && !metaInfDirectoryFile.isDirectory() )
+ {
metaInfBaseDirectory = null;
}
}
@@ -116,8 +118,10 @@ public class RadManifestWriter
{
boolean foundMetaInfBaseDirectory = false;
- for (EclipseSourceDir esd : sourceDirs) {
- if (esd.getPath().equals(metaInfBaseDirectory)) {
+ for ( EclipseSourceDir esd : sourceDirs )
+ {
+ if ( esd.getPath().equals( metaInfBaseDirectory ) )
+ {
foundMetaInfBaseDirectory = true;
break;
}
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java?rev=1517827&r1=1517826&r2=1517827&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java Tue Aug 27 14:16:42 2013
@@ -37,7 +37,7 @@ import org.codehaus.plexus.util.xml.XMLW
/**
* Creates a .settings folder for Eclipse WTP 1.x release and writes out the configuration under it.
- *
+ *
* @author <a href="mailto:nir@cfc.at">Richard van Nieuwenhoven </a>
*/
public class RadWebSettingsWriter
@@ -84,7 +84,7 @@ public class RadWebSettingsWriter
/**
* required default constructor.
- *
+ *
* @param warContextRoot the context root to use for this project
*/
public RadWebSettingsWriter( String warContextRoot )
@@ -94,7 +94,7 @@ public class RadWebSettingsWriter
/**
* write the websettings file for RAD6 if needed.
- *
+ *
* @throws MojoExecutionException when writing the config files was not possible
*/
public void write()
@@ -105,13 +105,14 @@ public class RadWebSettingsWriter
{
try
{
- w =
- new OutputStreamWriter( new FileOutputStream( new File( config.getEclipseProjectDirectory(),
- WEBSETTINGS_FILENAME ) ), "UTF-8" );
+ w = new OutputStreamWriter(
+ new FileOutputStream( new File( config.getEclipseProjectDirectory(), WEBSETTINGS_FILENAME ) ),
+ "UTF-8" );
}
catch ( IOException ex )
{
- throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); //$NON-NLS-1$
+ throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ),
+ ex ); //$NON-NLS-1$
}
XMLWriter writer = new PrettyPrintXMLWriter( w, "UTF-8", null );
@@ -122,7 +123,7 @@ public class RadWebSettingsWriter
/**
* write the websettings file for RAD6.
- *
+ *
* @param writer where to write to
* @throws MojoExecutionException
*/
@@ -134,10 +135,10 @@ public class RadWebSettingsWriter
writer.startElement( WEBSETTINGS_WEBCONTENT );
// Generating web content settings based on war plug-in warSourceDirectory property
- File warSourceDirectory =
- new File( IdeUtils.getPluginSetting( config.getProject(), JeeUtils.ARTIFACT_MAVEN_WAR_PLUGIN,
- "warSourceDirectory", //$NON-NLS-1$
- config.getProject().getBasedir() + "/src/main/webapp" ) ); //$NON-NLS-1$
+ File warSourceDirectory = new File(
+ IdeUtils.getPluginSetting( config.getProject(), JeeUtils.ARTIFACT_MAVEN_WAR_PLUGIN, "warSourceDirectory",
+ //$NON-NLS-1$
+ config.getProject().getBasedir() + "/src/main/webapp" ) ); //$NON-NLS-1$
String webContentDir =
IdeUtils.toRelativeAndFixSeparator( config.getEclipseProjectDirectory(), warSourceDirectory, false );
@@ -182,24 +183,26 @@ public class RadWebSettingsWriter
IdeDependency[] deps = config.getDeps();
if ( deps != null )
{
- for (final IdeDependency dependency : deps) {
- log.debug("RadWebSettingsWriter: checking dependency " + dependency.toString());
+ for ( final IdeDependency dependency : deps )
+ {
+ log.debug( "RadWebSettingsWriter: checking dependency " + dependency.toString() );
- if (dependency.isReferencedProject() && !dependency.isTestDependency() && !dependency.isProvided()) {
- log.debug("RadWebSettingsWriter: dependency " + dependency.toString()
- + " selected for inclusion as lib-module");
+ if ( dependency.isReferencedProject() && !dependency.isTestDependency() && !dependency.isProvided() )
+ {
+ log.debug( "RadWebSettingsWriter: dependency " + dependency.toString()
+ + " selected for inclusion as lib-module" );
String depName = dependency.getEclipseProjectName();
String depJar = dependency.getArtifactId() + ".jar";
- writer.startElement(WEBSETTINGS_LIBMODULE);
+ writer.startElement( WEBSETTINGS_LIBMODULE );
- writer.startElement(WEBSETTINGS_LM_JAR);
- writer.writeText(depJar);
+ writer.startElement( WEBSETTINGS_LM_JAR );
+ writer.writeText( depJar );
writer.endElement(); // jar
- writer.startElement(WEBSETTINGS_LM_PROJECT);
- writer.writeText(depName);
+ writer.startElement( WEBSETTINGS_LM_PROJECT );
+ writer.writeText( depName );
writer.endElement(); // project
writer.endElement(); // libmodule
@@ -214,7 +217,7 @@ public class RadWebSettingsWriter
/**
* Create the ContextRoot for this project, the default is the artifact id
- *
+ *
* @param warContextRoot set as a configuration property.
* @return the context root to use
*/
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseSettingsWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseSettingsWriter.java?rev=1517827&r1=1517826&r2=1517827&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseSettingsWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseSettingsWriter.java Tue Aug 27 14:16:42 2013
@@ -46,7 +46,8 @@ public class EclipseSettingsWriter
private static final String PROP_ECLIPSE_PREFERENCES_VERSION = "eclipse.preferences.version"; //$NON-NLS-1$
- private static final String PROP_JDT_CORE_COMPILER_COMPLIANCE = "org.eclipse.jdt.core.compiler.compliance"; //$NON-NLS-1$
+ private static final String PROP_JDT_CORE_COMPILER_COMPLIANCE = "org.eclipse.jdt.core.compiler.compliance";
+ //$NON-NLS-1$
private static final String PROP_JDT_CORE_COMPILER_SOURCE = "org.eclipse.jdt.core.compiler.source"; //$NON-NLS-1$
@@ -71,48 +72,52 @@ public class EclipseSettingsWriter
coreSettings.put( PROP_JDT_CORE_COMPILER_SOURCE, source );
coreSettings.put( PROP_JDT_CORE_COMPILER_COMPLIANCE, source );
}
-
+
if ( encoding != null )
{
File basedir = config.getProject().getBasedir();
- List compileSourceRoots = config.getProject().getCompileSourceRoots();
- if ( compileSourceRoots != null )
- {
- for (Object compileSourceRoot : compileSourceRoots) {
+ List compileSourceRoots = config.getProject().getCompileSourceRoots();
+ if ( compileSourceRoots != null )
+ {
+ for ( Object compileSourceRoot : compileSourceRoots )
+ {
String sourcePath = (String) compileSourceRoot;
- String relativePath = IdeUtils.toRelativeAndFixSeparator(basedir, new File(sourcePath), false);
- coreSettings.put(PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding);
+ String relativePath = IdeUtils.toRelativeAndFixSeparator( basedir, new File( sourcePath ), false );
+ coreSettings.put( PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding );
}
- }
- List testCompileSourceRoots = config.getProject().getTestCompileSourceRoots();
+ }
+ List testCompileSourceRoots = config.getProject().getTestCompileSourceRoots();
if ( testCompileSourceRoots != null )
- {
- for (Object testCompileSourceRoot : testCompileSourceRoots) {
+ {
+ for ( Object testCompileSourceRoot : testCompileSourceRoots )
+ {
String sourcePath = (String) testCompileSourceRoot;
- String relativePath = IdeUtils.toRelativeAndFixSeparator(basedir, new File(sourcePath), false);
- coreSettings.put(PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding);
+ String relativePath = IdeUtils.toRelativeAndFixSeparator( basedir, new File( sourcePath ), false );
+ coreSettings.put( PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding );
}
- }
- List resources = config.getProject().getResources();
+ }
+ List resources = config.getProject().getResources();
if ( resources != null )
- {
- for (Object resource1 : resources) {
+ {
+ for ( Object resource1 : resources )
+ {
Resource resource = (Resource) resource1;
String relativePath =
- IdeUtils.toRelativeAndFixSeparator(basedir, new File(resource.getDirectory()), false);
- coreSettings.put(PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding);
+ IdeUtils.toRelativeAndFixSeparator( basedir, new File( resource.getDirectory() ), false );
+ coreSettings.put( PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding );
}
- }
- List testResources = config.getProject().getTestResources();
+ }
+ List testResources = config.getProject().getTestResources();
if ( testResources != null )
- {
- for (Object testResource : testResources) {
+ {
+ for ( Object testResource : testResources )
+ {
Resource resource = (Resource) testResource;
String relativePath =
- IdeUtils.toRelativeAndFixSeparator(basedir, new File(resource.getDirectory()), false);
- coreSettings.put(PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding);
+ IdeUtils.toRelativeAndFixSeparator( basedir, new File( resource.getDirectory() ), false );
+ coreSettings.put( PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding );
}
- }
+ }
}
if ( target != null && !JDK_1_2_SOURCES.equals( target ) )
@@ -123,7 +128,8 @@ public class EclipseSettingsWriter
// write the settings, if needed
if ( !coreSettings.isEmpty() )
{
- File settingsDir = new File( config.getEclipseProjectDirectory(), EclipseWorkspaceWriter.DIR_DOT_SETTINGS ); //$NON-NLS-1$
+ File settingsDir =
+ new File( config.getEclipseProjectDirectory(), EclipseWorkspaceWriter.DIR_DOT_SETTINGS ); //$NON-NLS-1$
settingsDir.mkdirs();
@@ -160,11 +166,13 @@ public class EclipseSettingsWriter
}
catch ( FileNotFoundException e )
{
- throw new MojoExecutionException( Messages.getString( "EclipseSettingsWriter.cannotcreatesettings" ), e ); //$NON-NLS-1$
+ throw new MojoExecutionException( Messages.getString( "EclipseSettingsWriter.cannotcreatesettings" ),
+ e ); //$NON-NLS-1$
}
catch ( IOException e )
{
- throw new MojoExecutionException( Messages.getString( "EclipseSettingsWriter.errorwritingsettings" ), e ); //$NON-NLS-1$
+ throw new MojoExecutionException( Messages.getString( "EclipseSettingsWriter.errorwritingsettings" ),
+ e ); //$NON-NLS-1$
}
}
else