Some questions on my simple java example

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Some questions on my simple java example

Peter Voss
Hi,

first of all. It was easy to get Gradle running and also my first test  
in getting my very simple Java example compiled was easy to set up.

But I probably still don't really understand how to set up the  
dependencies.

I am using the following script:

========
usePlugin('java')

sourceCompatibility = 1.5
targetCompatibility = 1.5
group = 'org.petervoss'
version = '1.0-SNAPSHOT'

dependencies {
     test ":junit:4.4"
}
========

I expected this to fail, because it won't know from where to get the  
junit jar file, right? So my next step would have been to add an  
ibiblio resolver or a flat folder resolver, because the jar file also  
resides in a lib sub folder.

But I got the following error, which I don't understand:

========
% gradle test
Modern compiler found.
Recursive: true
Buildfilename: gradlefile
No build sources found.
:: loading settings :: url = jar:file:/usr/local/gradle-0.1.3/lib/
ivy-2.0.0.beta2_20080305165542.jar!/org/apache/ivy/core/settings/
ivysettings.xml
:: resolving dependencies :: org.gradle#build;SNAPSHOT
        confs: [build]
++++ Starting build for primary task: test
++ Loading Project objects
++ Configuring Project objects

Build aborted anormally.  Run with -s option to get stacktrace. Run  
with -d option to get all debug info including stacktrace. Run  
(additionally) with -f option to get the full (very verbose) stacktrace
Exception: org.gradle.api.GradleScriptException:  
groovy.lang.MissingMethodException: No signature of method:  
org.gradle.api.internal.dependencies.DefaultDependencyManager.test()  
is applicable for argument types: (java.lang.String) values: {":junit:
4.4"} Buildscript=gradlefile in line(s): 9 8

Total time: 1 seconds
Exit with error!
========

So it seems that I am not doing the right thing, but according to the  
documentation everything should be fine.

After that problem has been resolved: How would I finally get the  
junit jar from Maven? Do I just have to add the addIBiblio() call to  
the dependencies section?

I am really excited to continue working on my build script. Although I  
have to spend some more time understand Groovy better. ;-)

Thanks for your help,
--Peter

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Some questions on my simple java example

hans_d
Administrator
Hi Peter,

On Apr 29, 2008, at 8:43 PM, Peter Voss wrote:
Hi,

first of all. It was easy to get Gradle running and also my first test in getting my very simple Java example compiled was easy to set up.

But I probably still don't really understand how to set up the dependencies.

I am using the following script:

========
usePlugin('java')

sourceCompatibility = 1.5
targetCompatibility = 1.5
group = 'org.petervoss'
version = '1.0-SNAPSHOT'

dependencies {
    test ":junit:4.4"
}
========

I expected this to fail, because it won't know from where to get the junit jar file, right? So my next step would have been to add an ibiblio resolver or a flat folder resolver, because the jar file also resides in a lib sub folder.

But I got the following error, which I don't understand:

========
% gradle test
Modern compiler found.
Recursive: true
Buildfilename: gradlefile
No build sources found.
:: resolving dependencies :: org.gradle#build;SNAPSHOT
confs: [build]
++++ Starting build for primary task: test
++ Loading Project objects
++ Configuring Project objects

Build aborted anormally.  Run with -s option to get stacktrace. Run with -d option to get all debug info including stacktrace. Run (additionally) with -f option to get the full (very verbose) stacktrace
Exception: org.gradle.api.GradleScriptException: groovy.lang.MissingMethodException: No signature of method: org.gradle.api.internal.dependencies.DefaultDependencyManager.test() is applicable for argument types: (java.lang.String) values: {":junit:4.4"} Buildscript=gradlefile in line(s): 9 8

Total time: 1 seconds
Exit with error!
========

So it seems that I am not doing the right thing, but according to the documentation everything should be fine.

After that problem has been resolved: How would I finally get the junit jar from Maven? Do I just have to add the addIBiblio() call to the dependencies section?

I am really excited to continue working on my build script. Although I have to spend some more time understand Groovy better. ;-)

Thanks for your help,
--Peter

I still fall into the same trap now and then. I hope it is not written like this somewhere in the user's guide. If you look at section 11.2.6 of the user's guide you will find that the configuration is either testCompile or testRuntime, not test.

- Hans


---------------------------------------------------------------------
To unsubscribe from this list, please visit:




--
Hans Dockter
Gradle Project lead




Reply | Threaded
Open this post in threaded view
|

Re: Some questions on my simple java example

Peter Voss
Hi Hans,

On 29.04.2008, at 21:03, Hans Dockter wrote:

> Hi Peter,
>
> On Apr 29, 2008, at 8:43 PM, Peter Voss wrote:
>> Hi,
>>
>> first of all. It was easy to get Gradle running and also my first  
>> test in getting my very simple Java example compiled was easy to  
>> set up.
>>
>> But I probably still don't really understand how to set up the  
>> dependencies.
>>
>> I am using the following script:
>>
>> ========
>> usePlugin('java')
>>
>> sourceCompatibility = 1.5
>> targetCompatibility = 1.5
>> group = 'org.petervoss'
>> version = '1.0-SNAPSHOT'
>>
>> dependencies {
>>     test ":junit:4.4"
>> }
>> ========
>>
>> I expected this to fail, because it won't know from where to get  
>> the junit jar file, right? So my next step would have been to add  
>> an ibiblio resolver or a flat folder resolver, because the jar file  
>> also resides in a lib sub folder.
>>
>> But I got the following error, which I don't understand:
>>
>> ========
>> % gradle test
>> Modern compiler found.
>> Recursive: true
>> Buildfilename: gradlefile
>> No build sources found.
>> :: loading settings :: url = jar:file:/usr/local/gradle-0.1.3/lib/
>> ivy-2.0.0.beta2_20080305165542.jar!/org/apache/ivy/core/settings/
>> ivysettings.xml
>> :: resolving dependencies :: org.gradle#build;SNAPSHOT
>> confs: [build]
>> ++++ Starting build for primary task: test
>> ++ Loading Project objects
>> ++ Configuring Project objects
>>
>> Build aborted anormally.  Run with -s option to get stacktrace. Run  
>> with -d option to get all debug info including stacktrace. Run  
>> (additionally) with -f option to get the full (very verbose)  
>> stacktrace
>> Exception: org.gradle.api.GradleScriptException:  
>> groovy.lang.MissingMethodException: No signature of method:  
>> org
>> .gradle.api.internal.dependencies.DefaultDependencyManager.test()  
>> is applicable for argument types: (java.lang.String) values:  
>> {":junit:4.4"} Buildscript=gradlefile in line(s): 9 8
>>
>> Total time: 1 seconds
>> Exit with error!
>> ========
>>
>> So it seems that I am not doing the right thing, but according to  
>> the documentation everything should be fine.
>>
>> After that problem has been resolved: How would I finally get the  
>> junit jar from Maven? Do I just have to add the addIBiblio() call  
>> to the dependencies section?
>>
>> I am really excited to continue working on my build script.  
>> Although I have to spend some more time understand Groovy better. ;-)
>>
>> Thanks for your help,
>> --Peter
>
> I still fall into the same trap now and then. I hope it is not  
> written like this somewhere in the user's guide. If you look at  
> section 11.2.6 of the user's guide you will find that the  
> configuration is either testCompile or testRuntime, not test.

That solves my problem. Really cool. Gradle fails with all information  
that I need when using the testCompile dependency without a proper  
resolver. As soon as I add the flat dir resolver, my project compiles  
and is running the JUnit tests. Cool.
And, yes. This is from the documentation. I will file an issue for  
you. ;-)

Thanks for your prompt help,
--Peter


> - Hans
>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
> --
> Hans Dockter
> Gradle Project lead
> http://www.gradle.org
>
>
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email