Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Ant to gradle migration

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Im trying to migrate my code from ant to gradle and imported my build.xml in build.gradle and some of my tasks work fine.
However there are some tasks when i run them it says

Execution failed for task ':compile'.
> srcdir attribute must be set!

Pasting a snippet of my Build.xml and the compile task below is failing.

<project basedir="." default="deploy-copy" name="FitNesse">
<property name="fitnesse.target" value="/deploy/test-fitnesse"/>

<patternset id="test.patternset">
<include name="**/*Test*.java"/>
</patternset>
<propertyset id="test.propertyset">
<propertyref name="basedir"/>
<propertyref name="test.patternset"/>
</propertyset>


<fileset id="classpath.fitnesse" dir="./libs">
<include name="antlr-2.7.7.jar"/>
<include name="asm-4.1.jar"/>
<include name="asm-analysis-4.1.jar"/>
<include name="asm-commons-4.1.jar"/>
<include name="asm-tree-4.1.jar"/

><target name="compile" description="Compile the Qkn java sources" depends="clean">
<mkdir dir="build/classes"/>
<javac includeantruntime="false"/>
<javac srcdir="src/main/java" destdir="build/classes" debug="on">
<classpath refid="classpath.compile"/>
<compilerarg value="-processorpath"/>
<compilerarg value="-AmethodConstraintsSupported=true"/>
</javac>
</target>


Source folder structure
/src/main/java/com/xebia/incubator/xebium

I had changed my src folder structure from ant "src" to a gradle project "/src/main/java/com/xebia/incubator/xebium".

Please help. I'm kind of blocked.

Thanks,
abhi
 
Abhishek mura
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Somebody please help me on this...
 
Marshal
Posts: 25594
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Abhishek mura wrote:Execution failed for task ':compile'.
> srcdir attribute must be set!



I'm no Gradle expert, but if I got an error message which says "srcdir attribute must be set", the first thing I would try would be to set the srcdir attribute. I notice that your "compile" task doesn't have any such attribute, too, so it shouldn't be too hard to put one in. So why don't you try that? Let us know if you continue to have problems.
 
Abhishek mura
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the srcdir attribute added to the task already..
<javac srcdir="src/main/java" destdir="build/classes" debug="on">
 
Paul Clapham
Marshal
Posts: 25594
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(Still in non-expert mode:) Why are there two <javac> elements? Only one of them has a srcdir attribute.
 
Abhishek mura
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well should not matter, i tried with single javac element, and i still get the same error on srcdir
 
These are the worst of times and these are the best of times. And this is the best tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic