Building Robolectric

356 views
Skip to first unread message

fluxtah

unread,
Jul 6, 2011, 10:44:41 AM7/6/11
to Robolectric
Hi Guys,

I am having trouble running ant maven-install-jars.

I have confirmed maven is in the PATH, by running mvn --help.

I have tried elevating security (running cmd as an admin), nothing
seems to work, this is probably a common problem but I have'nt found a
solution yet, any help would be awesome cheers.

ERROR:

P:\sdev\proj\my\robolectric-fluxtah\robolectric\build.xml:206: Execute
failed: j
ava.io.IOException: Cannot run program "mvn": CreateProcess error=2,
The system
cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at java.lang.Runtime.exec(Runtime.java:593)
at org.apache.tools.ant.taskdefs.Execute
$Java13CommandLauncher.exec(Exec
ute.java:862)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:
481)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:
495)
at
org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:631)
at
org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:672)
at
org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:
1368)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:
1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:
109)
Caused by: java.io.IOException: CreateProcess error=2, The system
cannot find th
e file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 23 more

Total time: 0 seconds

fluxtah

unread,
Jul 6, 2011, 10:49:36 AM7/6/11
to Robolectric
Ok, looks like I solved the problem, on windows maven ships as
mvn.bat, I had to change this in the build.xml file:

<target name="maven-install-jars" description="Install the jar
files that Maven can't find for itself">
<exec executable="mvn">
<arg line="install:install-file -DgeneratePom=true -
DgroupId=com.google.android.maps -DartifactId=maps -Dversion=10_r1 -
Dpackaging=jar -Dfile=${sdk.dir}/add-ons/
addon_google_apis_google_inc_10/libs/maps.jar" />
</exec>
</target>

To this:

<target name="maven-install-jars" description="Install the jar
files that Maven can't find for itself">
<exec executable="mvn.bat">
<arg line="install:install-file -DgeneratePom=true -
DgroupId=com.google.android.maps -DartifactId=maps -Dversion=10_r1 -
Dpackaging=jar -Dfile=${sdk.dir}/add-ons/
addon_google_apis_google_inc_10/libs/maps.jar" />
</exec>
</target>

fluxtah

unread,
Jul 6, 2011, 11:01:34 AM7/6/11
to Robolectric
Sorry to keep spamming this topic, it seems like its not correctly
installing the dependency to my local repo, after successfully running
the ant maven-install-jars I only get this in my repo:

C:\Users\ian.warwick\.m2\repository\com\google\android\maps\maps
\10_r1\
_maven.repositories
maps-10_r1.jar.lastUpdated
maps-10_r1.pom

but no jar :(

maven complains as follows:

$ mvn install
[INFO] Scanning for projects...
[INFO]
[INFO]
------------------------------------------------------------------------
[INFO] Building Robolectric 1.0-RC2-SNAPSHOT
[INFO]
------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/com/google/android/maps/maps/10_r1/ma
ps-10_r1.jar
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 0.633s
[INFO] Finished at: Wed Jul 06 15:55:04 BST 2011
[INFO] Final Memory: 3M/15M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal on project robolectric: Could not
resolve depende
ncies for project com.pivotallabs:robolectric:jar:1.0-RC2-SNAPSHOT:
Could not fi
nd artifact com.google.android.maps:maps:jar:10_r1 in central (http://
repo1.mave
n.org/maven2) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with
the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions,
please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyReso
lutionException

Tyler Schultz

unread,
Jul 6, 2011, 11:11:23 AM7/6/11
to robol...@googlegroups.com
I assume you're working from head...

We are planning to bring robolectric up to version 12 as soon as we get a free moment, which means we'll be updating the maps jar version as well.  These maps jars continue to be problematic.

I've found a quick hack of a workaround is to manually copy the maps jar to  ~/.m2/repository/com/google/android/maps/maps
/10_r1/maps-10_r1.jar 

Or, you can point to 10_r2 in your POM.

We'll get this straightened out shortly.

Thanks,

--Tyler

fluxtah

unread,
Jul 6, 2011, 11:17:10 AM7/6/11
to Robolectric
Cheers Tyler,

Sorry I am just being a bit silly and not reading the errors properly,
the first problem is I have'nt updated my sdk manager with the latest
maps addon ((addon_google_apis_google_ic_10), and also it seems the
build.xml file is not resolving the path correctly which I can
workaround by passing it in on the command line using cygwin:

$ ant maven-install-jars -Dsdk.dir=/c/android\\sdk

Reply all
Reply to author
Forward
0 new messages