• Post Reply Bookmark Topic Watch Topic
  • New Topic

Running ANT Programmatically Through Java  RSS feed

 
Sujay Sarkhel
Greenhorn
Posts: 2
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I've a requirement where I have to extract metrics from different Java projects (configured in Eclipse) through Metrics Plugin. I am trying to automate this process using ANT build scripts.

I've made a Java utility project that will:
- create these build files
- put them in respective java projects configured in eclipse
- attempt to execute them.

While the build.xml are running correctly, when I try to run them programmatically, i get the following error:



I am assuming that the parse() method is not working correctly, but I don't understand why. Running the build.xml manually works (which means that the xml file is correctly created). The only modification that I had to make for Eclipse to run this build was to go to Run > External Tools > External Tools Configuration > JRE and select "Run in the same JRE as the workspace"

The build file is as follows:



Note: [projectName] and [ouputFile] are currently provided at the time of their creation, I just omitted them from this post. FYI, I'm using Eclipse Indigo.
The code where it fails looks as follows:


Any help from you would be appreciated! Thanks!!
 
Sujay Sarkhel
Greenhorn
Posts: 2
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the solution....apparently, I should have used:

instead of


Whilst this solves my initial problem, I run into the following error when the ANT target executes:


I used to get this problem when I used to execute the build file manually. All I had to do to make Eclipse run this build was to go to Run > External Tools > External Tools Configuration > JRE and select "Run in the same JRE as the workspace" and then attempt to execute.

My question is how to acheive the "Run in the same JRE as the workspace" feature programmatically?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!