Hi everyone,

I'm writing one custom Ant Task who create a classpath. This task can also
exlued files from the class path. But I'm unable to excludes files from the
Path because the path t the excluded file is wrong.
Here is my code :

> FileSet exclusions = new FileSet();

System.out.println("Parent : "+classpathFile.getParentFile());

exclusions.setDir(new File(Path.translateFile(classpathFile.getParent())));

exclusions.setProject(getProject());

Path antClassPath = new Path(getProject());

for (InternalClassPathEntry entry : eclipseClassPath.getEntries(entryKinds))
> {

PathElement element = antClassPath.createPathElement();

element.setLocation(new File(classpathFile.getParentFile(),
> entry.path.getPath()));

if ( entry.exclusions!=null && !entry.exclusions.isEmpty() ) {

for (String exclusion : entry.exclusions) {

System.out.println("Exclude :
> "+entry.path.getPath()+File.separatorChar+exclusion);

exclusions.createExcludesFile().setName(entry.path.getPath()+File.separatorChar+exclusion);

}

}

}

System.out.println(antClassPath);

antClassPath.addFileset(exclusions);


And the output :

> Buildfile: C:\Dev\Perso\App\app-builder\build.xml

test:

[eclipseclasspath] Parent : C:\Dev\Perso\App\app-impl\app-manager

[eclipseclasspath] Exclude :
> src.main\be/me/app/manager/commons/components/OgTreeTable.java

[eclipseclasspath] Exclude :
> src.main\be/me/app/manager/commons/models/TreeTableModel.java

[eclipseclasspath] Exclude :
> src.main\be/me/app/manager/commons/models/TreeTableModelAdapter.java

[eclipseclasspath] Exclude :
> src.main\be/me/app/manager/commons/models/AbstractTreeTableModel.java

[eclipseclasspath] Exclude : modules\epublish\be/me/sics/**/*

[eclipseclasspath] Exclude :
> modules\epublish\com/sun/star/beans/LocalOfficeConnection.java


> BUILD FAILED

C:\Dev\Perso\App\app-builder\build.xml:39: Excludesfile
> C:\Dev\Perso\App\app-builder\src.main\be\gervaisb\ogam\manager\commons\components\OgTreeTable.java
> not found.


> Total time: 233 milliseconds


The "Parent" folder correctly point to the project folder and each "Exclude"
are also existing : Parent+File.separator+Exclude give me a path to a real
file.
But the build fail and tell me that the file is not found. In fact she is
not found bacause ANt try to find it from a wrong folder. It will not look
into "C:\...\app-builder\" but into "C:\...\app-impl\app-manager\" (the
"Parent")

Can you help me please ?

Thanks


-- 
Gervais Blaise
<gervai...@gmail.com>

Reply via email to