You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by groovinfingers <ca...@gmail.com> on 2011/08/16 20:02:17 UTC

Using IvyDE with Android and Eclipse 3.6.1 and Mac 10.6.8

Hello.

I've been trying to use IvyDE to replace my .classpath entries with ivy.xml. 
My goal is to reference ivy.xml from both our ant scripts and our launch
configuration files while our dependencies remain in one place (i.e. in
ivy.xml).

To begin, I figured I'd limit my complexity by attempting to achieve one
goal - build an Android project in Eclipse while the project references
ivy.xml.  Since Eclipse will auto-build a project anytime the contents of a
file change, a successful build in my mind is one that contains no build
errors in Eclipse.  Note that I am not attempting to build this Android
project using ant.  I am solely building it using Eclipse.

I began by installing IvyDE using the Eclipse plugin installation URL that
is declared in the documentation.  Then, I restarted Eclipse.  Upon viewing
the Eclipse preferences menu, I can now see a menu entry for Ivy.  I made no
changes to this.

Next, I created a new Android project.  The project contains one activity
and shows Hello World on the screen.  I verified that I was able to install
the app on to my phone and that the app works.

Next step was to create a dependency on a jar.  I choose Google's gson
product.  I added the jar to our /lib folder and then added the jar to the
project's build path.  In our single Activity class, I then created an
instance of a class that is contained in the jar file.  I did this to ensure
that the project will recognize that it has a dependency on this jar.  The
project still builds successfully and the app runs fine on the phone.

OK - time to create a new ivy.xml file.  I did this by right-clicking the
project and selecting the create new file option.  I selected the option for
ivy file, followed the wizard, and then selected finish.  I made no changes
to any of the options in the wizard.  
I did manually add the reference to gson.  Here is the file.


<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
    <info 
        organisation="test"
        module="test-iv"
        status="integration">
	</info>
	<dependencies>
		<dependency org="com.google.gson" name="gson-1.7.1" rev="1.0"/>
	</dependencies>
</ivy-module>


Next, I followed the steps in the doc to essentially remove all dependencies
from the build path and instead add ivy.xml to the project's build path. 
This is where I started having problems.

After removing the reference to gson from the build path and then adding a
reference to ivy.xml to the build path, my build failed.  This is where I am
stuck.  Here is the error.


Description	Resource	Path	Location	Type
Impossible to resolve dependencies of
mm#test-iv;working@[removedForSecurity].local	ivy.xml	/testAndroid	Unknown
Problem

As a side note, I also attempted to use the Resolve feature so that the
ivy.xml file would be populated with an entry for gson.  This feature did
not work for me.

Does anyone have some advice to offer me?

Thanks for your time and for reading this far.

gf


-- 
View this message in context: http://old.nabble.com/Using-IvyDE-with-Android-and-Eclipse-3.6.1-and-Mac-10.6.8-tp32273911p32273911.html
Sent from the ivy-user mailing list archive at Nabble.com.


Re: Using IvyDE with Android and Eclipse 3.6.1 and Mac 10.6.8

Posted by groovinfingers <ca...@gmail.com>.
Thanks for your reply.  

I ended up removing Ivy and IvyDE (which made me sad).  I decided instead to
go with a pure Ant approach which ended up taking me a few hours to create.

With my solution, I can tell my developers to place their unit tests in
package A and integration tests in package B.  

When code changes are checked in to svn, our CI environment builds the
Android app.  If the build is successful, the CI environment then calls a
new ant target that I added to our build.xml file called run-tests.  

This target calls two other targets which represent our suites of unit and
integration tests.  Here's what the new build.xml file looks like.


<?xml version="1.0" encoding="UTF-8"?>
<project name="[removedForSecurity]" >
    <property file="local.properties" />
    <property file="build.properties" />
    <property file="default.properties" />
	<import file="${sdk.dir}/tools/ant/pre_setup.xml" />
    <setup />
	
	<property name="src" value="./src" />
	<property name="lib" value="./libs" />
	<property name="testinglib" value="./testinglib" />
	<property name="classes" value="./bin" />
	<property name="pathToUnitTestPackage"
value="com/[removed]/androidui/tests/unit" />
	<property name="pathToIntegrationTestPackage"
value="com/[removed]/androidui/tests/integration" />
	
	<path id="alltests.classpath">
	  <pathelement location="${lib}/junit.jar" />
	  <pathelement location="${classes}" />
	  <fileset dir="${lib}">
	    <include name="**/*.jar"/>
	  </fileset>
	  <fileset dir="${testinglib}">
	    <include name="**/*.jar"/>
	  	<exclude name="**/android.jar"/>
	  </fileset>
	</path>
	
	<target name="run-tests">
		<antcall target="run-unittests"></antcall>
		<antcall target="run-integrationtests"></antcall>
	</target>
	
	<target name="run-unittests">
		<!-- TODO -->
	</target>
	
	<target name="run-integrationtests" >
		  <junit fork="yes" haltonfailure="yes" showoutput="true">
		    <batchtest fork="yes">
		      <fileset dir="${classes}">
		        <include name="${pathToIntegrationTestPackage}/*.class"/>
		        <exclude
name="${pathToIntegrationTestPackage}/*[anythingYouWant]*.class"/>
		      </fileset>
		    </batchtest>
		  	<formatter type="plain" usefile="false" />
		    <classpath refid="alltests.classpath" />
		  </junit>
	</target>
</project>


With this approach, developers use any name they like for their test
classes.  As long as they place their classes in the one of the two
aforementioned packages, the ant script will execute the tests.  Since we
are using junit4, annotations are honored meaning that developers have the
option to use @Ignore for tests that the CI environment shouldn't execute.

Finally, all of our dependencies continue to remain in the /libs and
/testinglibs folders.  The contents of these folders are consumed by both
Eclipse (i.e. when the developer launches tests via a launch configuration)
and via Ant (i.e. when the CI environment launches the tests).  

One down side is that I don't have as much control over the order of the
classpath.  However, I've noticed that ant may honor the order via the order
of the <pathelement> and <fileset> elements that are contained in the <path>
element representing the classpath being used.

Again, thank you for your reply.  I would love to re-explore ivy in the
future.  I'm sorry that I didn't have enough time to figure out how to use
it with Android.  Perhaps someone could post the source code of a working
Android project to git hub which demonstrates how to use ivy.

gv


Nicolas Lalevée wrote:
> 
> 
> Le 16 août 2011 à 20:02, groovinfingers a écrit :
> 
>> 
>> Hello.
>> 
>> I've been trying to use IvyDE to replace my .classpath entries with
>> ivy.xml. 
>> My goal is to reference ivy.xml from both our ant scripts and our launch
>> configuration files while our dependencies remain in one place (i.e. in
>> ivy.xml).
>> 
>> To begin, I figured I'd limit my complexity by attempting to achieve one
>> goal - build an Android project in Eclipse while the project references
>> ivy.xml.  Since Eclipse will auto-build a project anytime the contents of
>> a
>> file change, a successful build in my mind is one that contains no build
>> errors in Eclipse.  Note that I am not attempting to build this Android
>> project using ant.  I am solely building it using Eclipse.
>> 
>> I began by installing IvyDE using the Eclipse plugin installation URL
>> that
>> is declared in the documentation.  Then, I restarted Eclipse.  Upon
>> viewing
>> the Eclipse preferences menu, I can now see a menu entry for Ivy.  I made
>> no
>> changes to this.
>> 
>> Next, I created a new Android project.  The project contains one activity
>> and shows Hello World on the screen.  I verified that I was able to
>> install
>> the app on to my phone and that the app works.
>> 
>> Next step was to create a dependency on a jar.  I choose Google's gson
>> product.  I added the jar to our /lib folder and then added the jar to
>> the
>> project's build path.  In our single Activity class, I then created an
>> instance of a class that is contained in the jar file.  I did this to
>> ensure
>> that the project will recognize that it has a dependency on this jar. 
>> The
>> project still builds successfully and the app runs fine on the phone.
>> 
>> OK - time to create a new ivy.xml file.  I did this by right-clicking the
>> project and selecting the create new file option.  I selected the option
>> for
>> ivy file, followed the wizard, and then selected finish.  I made no
>> changes
>> to any of the options in the wizard.  
>> I did manually add the reference to gson.  Here is the file.
>> 
>> 
>> <ivy-module version="2.0"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> 
>> xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
>>    <info 
>>        organisation="test"
>>        module="test-iv"
>>        status="integration">
>> 	</info>
>> 	<dependencies>
>> 		<dependency org="com.google.gson" name="gson-1.7.1" rev="1.0"/>
>> 	</dependencies>
>> </ivy-module>
>> 
>> 
>> Next, I followed the steps in the doc to essentially remove all
>> dependencies
>> from the build path and instead add ivy.xml to the project's build path. 
>> This is where I started having problems.
>> 
>> After removing the reference to gson from the build path and then adding
>> a
>> reference to ivy.xml to the build path, my build failed.  This is where I
>> am
>> stuck.  Here is the error.
>> 
>> 
>> Description	Resource	Path	Location	Type
>> Impossible to resolve dependencies of
>> mm#test-iv;working@[removedForSecurity].local	ivy.xml	/testAndroid
>> Unknown
>> Problem
>> 
>> As a side note, I also attempted to use the Resolve feature so that the
>> ivy.xml file would be populated with an entry for gson.  This feature did
>> not work for me.
>> 
>> Does anyone have some advice to offer me?
>> 
>> Thanks for your time and for reading this far.
> 
> quite long indeed, but very detailed and this helps understanding what you
> are trying to do :)
> 
> When you launch an ivy resolve, do you have any popup which says it failed
> ? In such case look at the "details" of the pop up to know what is going
> on.
> 
> To diagnose resolve issues, you can also look in the Ivy Console:
> http://ant.apache.org/ivy/ivyde/history/latest-milestone/console.html
> 
> Nicolas
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Using-IvyDE-with-Android-and-Eclipse-3.6.1-and-Mac-10.6.8-tp32273911p32289373.html
Sent from the ivy-user mailing list archive at Nabble.com.


Re: Using IvyDE with Android and Eclipse 3.6.1 and Mac 10.6.8

Posted by Nicolas Lalevée <ni...@hibnet.org>.
Le 16 août 2011 à 20:02, groovinfingers a écrit :

> 
> Hello.
> 
> I've been trying to use IvyDE to replace my .classpath entries with ivy.xml. 
> My goal is to reference ivy.xml from both our ant scripts and our launch
> configuration files while our dependencies remain in one place (i.e. in
> ivy.xml).
> 
> To begin, I figured I'd limit my complexity by attempting to achieve one
> goal - build an Android project in Eclipse while the project references
> ivy.xml.  Since Eclipse will auto-build a project anytime the contents of a
> file change, a successful build in my mind is one that contains no build
> errors in Eclipse.  Note that I am not attempting to build this Android
> project using ant.  I am solely building it using Eclipse.
> 
> I began by installing IvyDE using the Eclipse plugin installation URL that
> is declared in the documentation.  Then, I restarted Eclipse.  Upon viewing
> the Eclipse preferences menu, I can now see a menu entry for Ivy.  I made no
> changes to this.
> 
> Next, I created a new Android project.  The project contains one activity
> and shows Hello World on the screen.  I verified that I was able to install
> the app on to my phone and that the app works.
> 
> Next step was to create a dependency on a jar.  I choose Google's gson
> product.  I added the jar to our /lib folder and then added the jar to the
> project's build path.  In our single Activity class, I then created an
> instance of a class that is contained in the jar file.  I did this to ensure
> that the project will recognize that it has a dependency on this jar.  The
> project still builds successfully and the app runs fine on the phone.
> 
> OK - time to create a new ivy.xml file.  I did this by right-clicking the
> project and selecting the create new file option.  I selected the option for
> ivy file, followed the wizard, and then selected finish.  I made no changes
> to any of the options in the wizard.  
> I did manually add the reference to gson.  Here is the file.
> 
> 
> <ivy-module version="2.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 
> xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
>    <info 
>        organisation="test"
>        module="test-iv"
>        status="integration">
> 	</info>
> 	<dependencies>
> 		<dependency org="com.google.gson" name="gson-1.7.1" rev="1.0"/>
> 	</dependencies>
> </ivy-module>
> 
> 
> Next, I followed the steps in the doc to essentially remove all dependencies
> from the build path and instead add ivy.xml to the project's build path. 
> This is where I started having problems.
> 
> After removing the reference to gson from the build path and then adding a
> reference to ivy.xml to the build path, my build failed.  This is where I am
> stuck.  Here is the error.
> 
> 
> Description	Resource	Path	Location	Type
> Impossible to resolve dependencies of
> mm#test-iv;working@[removedForSecurity].local	ivy.xml	/testAndroid	Unknown
> Problem
> 
> As a side note, I also attempted to use the Resolve feature so that the
> ivy.xml file would be populated with an entry for gson.  This feature did
> not work for me.
> 
> Does anyone have some advice to offer me?
> 
> Thanks for your time and for reading this far.

quite long indeed, but very detailed and this helps understanding what you are trying to do :)

When you launch an ivy resolve, do you have any popup which says it failed ? In such case look at the "details" of the pop up to know what is going on.

To diagnose resolve issues, you can also look in the Ivy Console:
http://ant.apache.org/ivy/ivyde/history/latest-milestone/console.html

Nicolas