Bug #37

Unable to use generateWizard under Windows

Added by Clément Oudot over 1 year ago. Updated over 1 year ago.

Status:Closed Start:03/03/2009
Priority:Normal Due date:
Assigned to:Thomas Chemineau % Done:

100%

Category:Sample
Target version:1.1.0
Problem in version:

Description

Hello,

I've done new tests today under Windows. I use the snapshost tarball provided here: http://tools.lsc-project.org/projects/list_files/lsc

I use Eclipse 3.3.2 with Maven plugin, and an internet connection trough proxy. Windows version is XP.

Here are the steps:
- Extract the lsc-sample tarball somewhere in your hard drive
- Open Eclipse and create a new empty project (called for example lsc-ad2openldap):

File > New > Project

- Import the untared folder in your new project :
File > Import > General > File System

- Package your project to resolve maven dependencies with a right click on the file pom.xml:
Run As > Maven Package

- Launch the generateWizard by opening the file build.xml and in "outline", right click on task generateWizard:
Run As > Ant build

The first steps of the wizard are ok. Error occurs when we click on generate:

org.tp23.antinstaller.InstallException: Error running the install, C:\DOCUME~1\p0075\Local Settings\Temp\antinstall0\${env.PWD}\lib not found.
    at org.tp23.antinstaller.runtime.exe.AntProjectFilter.exec(AntProjectFilter.java:172)
    at org.tp23.antinstaller.runtime.ExecInstall.exec(ExecInstall.java:85)
    at org.tp23.antinstaller.selfextract.NonExtractor.main(NonExtractor.java:59)
Caused by: jar:file:/C:/Documents%20and%20Settings/p0075/workspace/lsc-monecam-ad2openldap/lib/lsc-sample-generator.jar!/build.xml:21: C:\DOCUME~1\p0075\Local Settings\Temp\antinstall0\${env.PWD}\lib not found.
    at org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileSet.java:422)
    at org.apache.tools.ant.types.FileSet.iterator(FileSet.java:69)
    at org.apache.tools.ant.types.resources.Union.getCollection(Union.java:105)
    at org.apache.tools.ant.types.resources.Union.getCollection(Union.java:88)
    at org.apache.tools.ant.types.resources.BaseResourceCollectionContainer.cacheCollection(BaseResourceCollectionContainer.java:244)
    at org.apache.tools.ant.types.resources.BaseResourceCollectionContainer.iterator(BaseResourceCollectionContainer.java:120)
    at org.apache.tools.ant.types.Path.iterator(Path.java:687)
    at org.apache.tools.ant.types.resources.Union.getCollection(Union.java:105)
    at org.apache.tools.ant.types.resources.Union.list(Union.java:67)
    at org.apache.tools.ant.types.Path.list(Path.java:356)
    at org.apache.tools.ant.types.Path.addExisting(Path.java:327)
    at org.apache.tools.ant.types.Path.addExisting(Path.java:315)
    at org.apache.tools.ant.types.Path.concatSpecialPath(Path.java:552)
    at org.apache.tools.ant.types.Path.concatSystemClasspath(Path.java:512)
    at org.apache.tools.ant.AntClassLoader.setClassPath(AntClassLoader.java:353)
    at org.apache.tools.ant.AntClassLoader.<init>(AntClassLoader.java:240)
    at org.apache.tools.ant.Project.createClassLoader(Project.java:328)
    at org.apache.tools.ant.util.ClasspathUtils.getUniqueClassLoaderForPath(ClasspathUtils.java:219)
    at org.apache.tools.ant.util.ClasspathUtils.getClassLoaderForPath(ClasspathUtils.java:194)
    at org.apache.tools.ant.util.ClasspathUtils$Delegate.getClassLoader(ClasspathUtils.java:445)
    at org.apache.tools.ant.taskdefs.DefBase.createLoader(DefBase.java:142)
    at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:197)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:357)
    at org.tp23.antinstaller.antmod.ProjectHelper3.parse(ProjectHelper3.java:133)
    at org.tp23.antinstaller.runtime.exe.AntProjectFilter.exec(AntProjectFilter.java:154)
    ... 2 more
--- Nested Exception ---
jar:file:/C:/Documents%20and%20Settings/p0075/workspace/lsc-monecam-ad2openldap/lib/lsc-sample-generator.jar!/build.xml:21: C:\DOCUME~1\p0075\Local Settings\Temp\antinstall0\${env.PWD}\lib not found.
    at org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileSet.java:422)
    at org.apache.tools.ant.types.FileSet.iterator(FileSet.java:69)
    at org.apache.tools.ant.types.resources.Union.getCollection(Union.java:105)
    at org.apache.tools.ant.types.resources.Union.getCollection(Union.java:88)
    at org.apache.tools.ant.types.resources.BaseResourceCollectionContainer.cacheCollection(BaseResourceCollectionContainer.java:244)
    at org.apache.tools.ant.types.resources.BaseResourceCollectionContainer.iterator(BaseResourceCollectionContainer.java:120)
    at org.apache.tools.ant.types.Path.iterator(Path.java:687)
    at org.apache.tools.ant.types.resources.Union.getCollection(Union.java:105)
    at org.apache.tools.ant.types.resources.Union.list(Union.java:67)
    at org.apache.tools.ant.types.Path.list(Path.java:356)
    at org.apache.tools.ant.types.Path.addExisting(Path.java:327)
    at org.apache.tools.ant.types.Path.addExisting(Path.java:315)
    at org.apache.tools.ant.types.Path.concatSpecialPath(Path.java:552)
    at org.apache.tools.ant.types.Path.concatSystemClasspath(Path.java:512)
    at org.apache.tools.ant.AntClassLoader.setClassPath(AntClassLoader.java:353)
    at org.apache.tools.ant.AntClassLoader.<init>(AntClassLoader.java:240)
    at org.apache.tools.ant.Project.createClassLoader(Project.java:328)
    at org.apache.tools.ant.util.ClasspathUtils.getUniqueClassLoaderForPath(ClasspathUtils.java:219)
    at org.apache.tools.ant.util.ClasspathUtils.getClassLoaderForPath(ClasspathUtils.java:194)
    at org.apache.tools.ant.util.ClasspathUtils$Delegate.getClassLoader(ClasspathUtils.java:445)
    at org.apache.tools.ant.taskdefs.DefBase.createLoader(DefBase.java:142)
    at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:197)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:357)
    at org.tp23.antinstaller.antmod.ProjectHelper3.parse(ProjectHelper3.java:133)
    at org.tp23.antinstaller.runtime.exe.AntProjectFilter.exec(AntProjectFilter.java:154)
    at org.tp23.antinstaller.runtime.ExecInstall.exec(ExecInstall.java:85)
    at org.tp23.antinstaller.selfextract.NonExtractor.main(NonExtractor.java:59)

platform-specific-dirs-installer.patch - Proposed patch to enable Windows-specific environment variables (1.9 KB) Jonathan Clarke, 03/03/2009 17:19

ant.install.log (163.1 KB) Thomas Chemineau, 16/04/2009 10:15

ant.install.log (81.6 KB) Thomas Chemineau, 16/04/2009 15:41

Associated revisions

Revision 192
Added by Jonathan Clarke over 1 year ago

Correct generatorWizard on Windows. References #37.

Revision 194
Added by Jonathan Clarke over 1 year ago

Encode special characters in filenames to URI format. References #37.

Revision 195
Added by Jonathan Clarke over 1 year ago

Quote paths and filenames because they may contain spaces. References #37.

Revision 196
Added by Jonathan Clarke over 1 year ago

References #37. More from previous commits.

Revision 197
Added by Jonathan Clarke over 1 year ago

References #37. Get the right path on Windows and *NIX.

Revision 198
Added by Thomas Chemineau over 1 year ago

fixes #37 - Some errors with generating correct path under windows

History

Updated by Jonathan Clarke over 1 year ago

  • Status changed from New to Assigned
  • Assigned to set to Jonathan Clarke
  • Target version set to 1.1.0

Thanks for this.

We've come across this error before - it is because Windows does not have the environment variable "env.PWD". It uses "env.Path" (case-sensitive), apparently.

I will try and fix this in the build file bundled in AntInstaller.

Updated by Clément Oudot over 1 year ago

Hello,

I'm doing tests now. I think we have to use the ant ${basedir} varibale rather than env. This will be cross-OS compliant.

Clément.

Updated by Jonathan Clarke over 1 year ago

Unfortunately, ${basedir} doesn't work, since the build file from AntInstaller is run in a temporary dir (/tmp/antinstaller/something), therefore basedir=/tmp...

Can you try the attached patch? Just apply it, and regenerate the generateWizard (run ant lsc::buildGenerateWizard on the Windows machine or a UNIX machine and copy over lib/lsc-sample-generator.jar).

Updated by Clément Oudot over 1 year ago

This did not work.

A remark: env.Path returns the PATH varibale, which is not what we want. The correct environnement variable is CD under windows.

Updated by Jonathan Clarke over 1 year ago

Right. env.CD it is. Did you try with this? What error do you get?

Updated by Clément Oudot over 1 year ago

Hello,

now env.CD is not recognized by ant, or ant installer.

I tried to define an LSC.home variable in build.properties, but this did not work:

    <property file="${user.home}/.${ant.project.name}-build.properties" />
    <property file="${user.home}/build.properties" />
    <property file="../../../build.properties" />
    <property environment="env" />

    <property name="workdir" value="${LSC.home}" />

Maybe we should propose an alternative to AntInstaller to generate the code...

Updated by Jonathan Clarke over 1 year ago

Hmmm. I will try and look into this soon, when I have access to a Windows machine.

Meanwhile, you can use ant lsc::_generator to generate the code, it is a direct call to the Java generator (without AntInstaller). It is not documented on the website, but the help is quite verbose.

Updated by Clément Oudot over 1 year ago

Hello,

this works. You have to set connection properties into src/test/resources/lsc.properties, and launch the lsc::_generate task with (for example) :

-Dgenerator.parameters="-dir ../../src/impl/java -doc 'inetOrgPerson' -name inetOrgPerson -ldap2ldap -soc 'user'" 

I've done by creating an external tool into Eclipse.

I find this easier than the AntInstaller process.

Clément.

Updated by Sébastien Bahloul over 1 year ago

  • Assigned to changed from Jonathan Clarke to Sébastien Bahloul

I take it.

Updated by Thomas Chemineau over 1 year ago

The patch proposed by Jonathan is incomplete. He will normaly submit another one quickly :)
The solution found is to use the "user.dir" environment property in src/install/resources/build-generator.xml, which is proposed in standard. It should work on all system.

It tested lsc::generateWizard this morning, but I had then an other error relative to spaces in pathes :) See the file attached to get the full exception.

     [java] 1232 [main] ERROR  org.lsc.AbstractGenerator.writeContent(AbstractGenerator.java:346)   - java.io.IOException: Le chemin d'accès spécifié est introuvable (C:\Documents/org/lsc/objects/user.java)

Updated by Jonathan Clarke over 1 year ago

  • Assigned to changed from Sébastien Bahloul to Thomas Chemineau
  • % Done changed from 0 to 80

I've commited a fix for the "env.PWD" problem (we now user "user.dir", which is platform agnostic, and allowed in ant buildfiles bundled in AntInstaller. Whew.).

The next problem Thomas found, is actually the same on all platforms - if the base directory contains a space, weird things happen. I've commited a fix for this too.

These fixes apply to lsc-core and lsc-sample. To test, please download latest lsc-sample (specifically the lib/lsc-sample-generator.jar file), and latest lsc-core-SNAPSHOT (Maven should do this automatically from lsc-sample).

Thomas, can you test on Windows?

Updated by Thomas Chemineau over 1 year ago

A simple test. It seems that / and \ characters are not interpreted in the same way when they appear in pathes. My apologies Jon ;)
See attachment.

Updated by Thomas Chemineau over 1 year ago

  • Status changed from Assigned to Feedback
  • % Done changed from 80 to 100

Applied in changeset r198.

Updated by Jonathan Clarke over 1 year ago

  • Status changed from Feedback to Closed

Closing bug! Using LSC-sample is now fully tested on Windows, and works! :)))

Also available in: Atom PDF