mirror of https://github.com/apache/maven.git
o When eclipse files are created in another location, add a link to the pom;
o Fixed some coding style errors; git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@226695 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
33ee96ceb9
commit
64887493fe
|
@ -167,6 +167,8 @@ public class EclipseWriter
|
|||
{
|
||||
writer.startElement( "linkedResources" );
|
||||
|
||||
addFileLink( writer, projectBaseDir, basedir, project.getFile() );
|
||||
|
||||
addSourceLinks( writer, projectBaseDir, basedir, executedProject.getCompileSourceRoots() );
|
||||
|
||||
addResourceLinks( writer, projectBaseDir, basedir, executedProject.getBuild().getResources() );
|
||||
|
@ -302,7 +304,9 @@ public class EclipseWriter
|
|||
|
||||
sourceRoot = toRelative( projectBaseDir, sourceRoot );
|
||||
if (!projectBaseDir.equals(basedir))
|
||||
sourceRoot = sourceRoot.replaceAll("/", "-");
|
||||
{
|
||||
sourceRoot = sourceRoot.replaceAll( "/", "-" );
|
||||
}
|
||||
|
||||
writer.addAttribute( "path", sourceRoot );
|
||||
|
||||
|
@ -353,7 +357,9 @@ public class EclipseWriter
|
|||
String resourceDir = resource.getDirectory();
|
||||
resourceDir = toRelative( projectBaseDir, resourceDir );
|
||||
if (!projectBaseDir.equals(basedir))
|
||||
resourceDir = resourceDir.replaceAll("/", "-");
|
||||
{
|
||||
resourceDir = resourceDir.replaceAll( "/", "-" );
|
||||
}
|
||||
|
||||
writer.addAttribute( "path", resourceDir );
|
||||
|
||||
|
@ -378,7 +384,7 @@ public class EclipseWriter
|
|||
|
||||
writer.startElement( "name" );
|
||||
|
||||
writer.writeText( toRelative( projectBaseDir, sourceRoot ).replaceAll("/", "-") );
|
||||
writer.writeText( toRelative( projectBaseDir, sourceRoot ).replaceAll( "/", "-" ) );
|
||||
|
||||
writer.endElement(); // name
|
||||
|
||||
|
@ -411,7 +417,7 @@ public class EclipseWriter
|
|||
|
||||
writer.startElement( "name" );
|
||||
|
||||
writer.writeText( toRelative( projectBaseDir, resourceDir ).replaceAll("/", "-") );
|
||||
writer.writeText( toRelative( projectBaseDir, resourceDir ).replaceAll( "/", "-" ) );
|
||||
|
||||
writer.endElement(); // name
|
||||
|
||||
|
@ -432,6 +438,38 @@ public class EclipseWriter
|
|||
}
|
||||
}
|
||||
|
||||
private void addFileLink( XMLWriter writer, File projectBaseDir, File basedir, File file )
|
||||
{
|
||||
if ( file.isFile() )
|
||||
{
|
||||
writer.startElement( "link" );
|
||||
|
||||
writer.startElement( "name" );
|
||||
|
||||
writer.writeText( toRelative( projectBaseDir, file.toString() ).replaceAll( "/", "-" ) );
|
||||
|
||||
writer.endElement(); // name
|
||||
|
||||
writer.startElement( "type" );
|
||||
|
||||
writer.writeText( "1" );
|
||||
|
||||
writer.endElement(); // type
|
||||
|
||||
writer.startElement( "location" );
|
||||
|
||||
writer.writeText( file.toString() );
|
||||
|
||||
writer.endElement(); // location
|
||||
|
||||
writer.endElement(); // link
|
||||
}
|
||||
else
|
||||
{
|
||||
log.warn( "Not adding a file link to " + file + "; it is not a file" );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param writer
|
||||
|
|
Loading…
Reference in New Issue