saiddfhi / gwt-maven

Automatically exported from code.google.com/p/gwt-maven
0 stars 0 forks source link

gwt:gwt fails when workspace path contains spaces on Mac OS X #188

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Is this Maven 1 or Maven 2?
Maven 2

What steps will reproduce the problem?

1. create new project in /Users/joe/workspace/gwt tool/ with 
archetype:create command

mvn archetype:create -DarchetypeGroupId=com.totsp.gwt -
DarchetypeArtifactId=maven-googlewebtoolkit2-archetype -
DarchetypeVersion=1.0.3 -DremoteRepositories=http://gwt-
maven.googlecode.com/svn/trunk/mavenrepo -DartifactId=spacestest -
DgroupId=plugin

2. open command line in Terminal window and navigate to /Users/joe/
workspace/gwt tool/spacestest/ and execute: mvn -e gwt:gwt

What is the expected output? What do you see instead?

Expected: successful build
Actual: 

+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'gwt'.
[INFO] 
------------------------------------------------------------------------
[INFO] Building gwt-maven-archetype-project
[INFO]    task-segment: [gwt:gwt]
[INFO] 
------------------------------------------------------------------------
[INFO] Preparing gwt:gwt
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Compiling 1 source file to /Users/joe/workspace/gwt tool/spacestest/
target/classes
[INFO] [dependency:unpack {execution: unpack}]
[INFO] Configured Artifact: com.google.gwt:gwt-dev:mac-libs:1.5.3:zip
[INFO] Unpacking /Users/joe/.m2/repository/com/google/gwt/gwt-dev/1.5.3/
gwt-dev-1.5.3-mac-libs.zipto
 /Users/joe/.m2/repository/com/google/gwt/gwt-dev/1.5.3
with Includes null and excludes:null
[INFO] [gwt:gwt]
[INFO] source web.xml present - /Users/joe/workspace/gwt tool/spacestest/
src/main/webapp/WEB-INF/web.xml - using it with embedded Tomcat
[INFO] establishing classpath list (buildClaspathList - scope = RUNTIME)
[INFO] google.webtoolkit.home (gwtHome) *not* set, using project POM for 
GWT dependencies
chmod: /Users/joe/workspace/gwt: No such file or directory
chmod: tool/spacestest/target/run.sh: No such file or directory
[INFO] 
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] 
------------------------------------------------------------------------
[INFO] Exception attempting to run script - run.sh

Embedded error: Cannot run program "/Users/joe/workspace/gwt": error=2, No 
such file or directory
[INFO] 
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Exception 
attempting to run script - run.sh
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
(DefaultLifecycleExecutor.java:583)
    at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal
(DefaultLifecycleExecutor.java:512)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
(DefaultLifecycleExecutor.java:482)
    at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
(DefaultLifecycleExecutor.java:330)
    at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments
(DefaultLifecycleExecutor.java:291)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute
(DefaultLifecycleExecutor.java:142)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
    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:597)
    at org.codehaus.classworlds.Launcher.launchEnhanced
(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode
(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Exception 
attempting to run script - run.sh
    at com.totsp.mavenplugin.gwt.scripting.ScriptUtil.runScript
(ScriptUtil.java:32)
    at com.totsp.mavenplugin.gwt.GWTMojo.execute(GWTMojo.java:72)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo
(DefaultPluginManager.java:451)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
(DefaultLifecycleExecutor.java:558)
    ... 16 more
Caused by: java.io.IOException: Cannot run program "/Users/joe/workspace/
gwt": error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
    at java.lang.Runtime.exec(Runtime.java:593)
    at java.lang.Runtime.exec(Runtime.java:431)
    at com.totsp.mavenplugin.gwt.scripting.ProcessWatcher.startProcess
(ProcessWatcher.java:76)
    at com.totsp.mavenplugin.gwt.scripting.ProcessWatcher.startProcess
(ProcessWatcher.java:102)
    at com.totsp.mavenplugin.gwt.scripting.ScriptUtil.runScript
(ScriptUtil.java:25)
    ... 19 more
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:53)
    at java.lang.ProcessImpl.start(ProcessImpl.java:91)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
    ... 24 more

What version of the product are you using? On what operating system?

<groupId>com.totsp.gwt</groupId>
<artifactId>maven-googlewebtoolkit2-plugin</artifactId>
<version>2.0-beta26</version>

On Mac OS X, Version 10.5.6, Build 9G55

Please provide any additional information below.

GWT_HOME=/Applications/ext/google/gwt-mac-1.5.3
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
M2_HOME=/Applications/ext/tools/apache-maven-2.0.9

Original issue reported on code.google.com by joe.cul...@gmail.com on 16 Jan 2009 at 9:33

GoogleCodeExporter commented 9 years ago
Thankfully nobody in their right mind uses spaces in a path, especially on a 
Mac ;). 

Seriously, issue noted/accepted.  Low priority (first time I have heard of it), 
but
yes should be fixed. 

Original comment by charlie....@gmail.com on 22 Jan 2009 at 12:41

GoogleCodeExporter commented 9 years ago

Original comment by charlie....@gmail.com on 24 Jan 2009 at 11:20

GoogleCodeExporter commented 9 years ago

Original comment by charlie....@gmail.com on 26 Jan 2009 at 11:01

GoogleCodeExporter commented 9 years ago
Linux produce the same problem.

Original comment by richard...@cherubim.com.hk on 31 Mar 2009 at 7:22

GoogleCodeExporter commented 9 years ago
Actually, you should use
Runtime.getRuntime().exec(String[] command, String envirionment, File dir) 
instead of
Runtime.getRuntime().exec(String command, String envirionment, File dir)

Upon tokenize the parameters in String[] properly, the space problem will be
disappeared and the script will be more portable.

Original comment by richard...@cherubim.com.hk on 31 Mar 2009 at 8:56

GoogleCodeExporter commented 9 years ago
Forgot one point, executing directly without the use of a script is better.  
Script
will break easily with path name problem with spaces.

Original comment by richard...@cherubim.com.hk on 31 Mar 2009 at 9:01

GoogleCodeExporter commented 9 years ago
Confirmed, same issue present on Linux.  Looks like the "Unix" ProcessBuilder, 
which
is trying to account for spaces, fails. 

[DEBUG] File '/home/ccollins/projects/simple sample/target/i18n.sh' does not 
exsists,
trying to create.
[DEBUG] New file '/home/ccollins/projects/simple sample/target/i18n.sh' created.
[INFO] establishing classpath list (buildClaspathList - scope = COMPILE)
[INFO] google.webtoolkit.home (gwtHome) *not* set, using project POM for GWT 
dependencies
[DEBUG] injecting gwt-user and gwt-dev for script classpath from local 
repository
(and expecting relative native libs)
[DEBUG] SCRIPT INJECTION CLASSPATH LIST
[DEBUG]    
/home/ccollins/.m2/repository/com/google/gwt/gwt-user/1.5.3/gwt-user-1.5.3.jar
[DEBUG]   
/home/ccollins/.m2/repository/com/google/gwt/gwt-dev/1.5.3/gwt-dev-1.5.3-linux.j
ar
[DEBUG]    /home/ccollins/projects/simple sample/src/main/java
[DEBUG]    /home/ccollins/projects/simple sample/src/main/resources
[DEBUG]    /home/ccollins/projects/simple sample/target/classes
[DEBUG]    /home/ccollins/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar
chmod: cannot access `/home/ccollins/projects/simple': No such file or directory
chmod: cannot access `sample/target/i18n.sh': No such file or directory
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Exception attempting to run script - i18n.sh

Embedded error: Cannot run program "/home/ccollins/projects/simple":
java.io.IOException: error=2, No such file or directory
[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Exception attempting to 
run
script - i18n.sh
    at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycl
eExecutor.java:583)
    at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(Def
aultLifecycleExecutor.java:499)
    at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(Default
LifecycleExecutor.java:924)
    at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecyc
leExecutor.java:767)
    at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycl
eExecutor.java:529)
    at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(Defaul
tLifecycleExecutor.java:512)
    at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycle
Executor.java:482)
    at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
(DefaultLifecycleExecutor.java:330)
    at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultL
ifecycleExecutor.java:291)
    at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExec
utor.java:142)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
    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:597)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Exception attempting 
to
run script - i18n.sh
    at com.totsp.mavenplugin.gwt.scripting.ScriptUtil.runScript(ScriptUtil.java:32)
    at com.totsp.mavenplugin.gwt.I18NMojo.execute(I18NMojo.java:68)
    at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.ja
va:451)
    at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycl
eExecutor.java:558)
    ... 20 more
Caused by: java.io.IOException: Cannot run program 
"/home/ccollins/projects/simple":
java.io.IOException: error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
    at java.lang.Runtime.exec(Runtime.java:593)
    at java.lang.Runtime.exec(Runtime.java:431)
    at
com.totsp.mavenplugin.gwt.scripting.ProcessWatcher.startProcess(ProcessWatcher.j
ava:76)
    at
com.totsp.mavenplugin.gwt.scripting.ProcessWatcher.startProcess(ProcessWatcher.j
ava:102)
    at com.totsp.mavenplugin.gwt.scripting.ScriptUtil.runScript(ScriptUtil.java:25)
    ... 23 more
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or 
directory
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
    at java.lang.ProcessImpl.start(ProcessImpl.java:65)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
    ... 28 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Tue Mar 31 15:00:08 EST 2009
[INFO] Final Memory: 10M/102M
[INFO] ------------------------------------------------------------------------

Original comment by charlie....@gmail.com on 31 Mar 2009 at 8:01

GoogleCodeExporter commented 9 years ago
I had to change several areas in ScriptUtil and UnixScriptWriter, basically to 
always
pass arrays to ProcessWatcher (which wraps Runtime.exec - which tokenizes the 
input
if you don't pass it an array).  

I also had to change the way we quote the classpath in the scripts. This now 
works
for me with simple tests on Linux and Mac using spaces. 

Giant pain in the ass though, worked on the spaces thing for 3 hours today, 
thought
it would be simple, thought wrong. ;)

Original comment by charlie....@gmail.com on 1 Apr 2009 at 12:24

GoogleCodeExporter commented 9 years ago
In 2.0-RC1. 

Original comment by charlie....@gmail.com on 3 Apr 2009 at 1:16