Author: fgiust Date: Mon Jul 17 13:58:51 2006 New Revision: 422867 URL: http://svn.apache.org/viewvc?rev=422867&view=rev Log: improve relative paths handling for pde lib dir
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseOSGiManifestWriter.java Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java?rev=422867&r1=422866&r2=422867&view=diff ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java Mon Jul 17 13:58:51 2006 @@ -237,7 +237,7 @@ * * @parameter expression="${eclipse.pdeLibDir}" default-value="${basedir}/lib" */ - private String pdeLibDir; + private File pdeLibDir; /** * Not a plugin parameter. Are we working with wtp r7? Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java?rev=422867&r1=422866&r2=422867&view=diff ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java Mon Jul 17 13:58:51 2006 @@ -118,8 +118,7 @@ } public void write( File projectBaseDir, EclipseSourceDir[] sourceDirs, List classpathContainers, - ArtifactRepository localRepository, File buildOutputDirectory, boolean inPdeMode, - String pdeLibDir ) + ArtifactRepository localRepository, File buildOutputDirectory, boolean inPdeMode, File pdeLibDir ) throws MojoExecutionException { @@ -203,7 +202,7 @@ } private void addDependency( XMLWriter writer, IdeDependency dep, ArtifactRepository localRepository, - File projectBaseDir, boolean inPdeMode, String pdeLibDir ) + File projectBaseDir, boolean inPdeMode, File pdeLibDir ) throws MojoExecutionException { @@ -249,19 +248,18 @@ { try { - // TODO problem with reactor build - File libsDir = new File( projectBaseDir, pdeLibDir ); - if ( !libsDir.exists() ) + + if ( !pdeLibDir.exists() ) { - libsDir.mkdirs(); + pdeLibDir.mkdirs(); } - FileUtils.copyFileToDirectory( dep.getFile(), libsDir ); + FileUtils.copyFileToDirectory( dep.getFile(), pdeLibDir ); } catch ( IOException e ) { throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantcopyartifact", dep - .getArtifactId() ) ); + .getArtifactId() ), e ); } path = pdeLibDir + "/" + dep.getFile().getName(); kind = ATTR_LIB; 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=422867&r1=422866&r2=422867&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 Mon Jul 17 13:58:51 2006 @@ -25,6 +25,7 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.eclipse.Messages; import org.apache.maven.plugin.ide.IdeDependency; +import org.apache.maven.plugin.ide.IdeUtils; import org.apache.maven.plugin.logging.Log; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.util.IOUtil; @@ -45,7 +46,7 @@ super( log, eclipseProjectDir, project, deps ); } - public void write( File manifestFile, String libdir ) + public void write( File manifestFile, File libdir ) throws MojoExecutionException { // check for existence @@ -79,7 +80,7 @@ } } - protected StringBuffer rewriteManifest( File manifestFile, String libdir ) + protected StringBuffer rewriteManifest( File manifestFile, File libdir ) throws MojoExecutionException { boolean inBundleClasspathEntry = false; @@ -125,8 +126,10 @@ /** * Add all libraries that don't have the scope "provided" to the "Bundle-Classpath". + * @throws MojoExecutionException */ - protected String addBundleClasspathEntries( String libdir ) + protected String addBundleClasspathEntries( File libdir ) + throws MojoExecutionException { StringBuffer bundleClasspathSb = new StringBuffer( ENTRY_BUNDLE_CLASSPATH ); int countAddedLibs = 0; @@ -139,8 +142,13 @@ // TODO problems with line endings might appear bundleClasspathSb.append( ",\n" ); } - System.out.println( "artifact: " + this.deps[i].getArtifactId() ); - bundleClasspathSb.append( " " + libdir + "/" + this.deps[i].getFile().getName() + "" ); + + getLog().debug( "Adding artifact to manifest: " + this.deps[i].getArtifactId() ); + + File artifactFile = new File( libdir, this.deps[i].getFile().getName() ); + + bundleClasspathSb.append( " " + + IdeUtils.toRelativeAndFixSeparator( getEclipseProjectDirectory(), artifactFile, false ) ); countAddedLibs++; } }