Menu

#3 Antx doesn't work with eclipse AntRunner

open
nobody
5
2012-12-16
2008-10-28
Anonymous
No

I'm developing a plugin that runs an ant build script using eclipse's ant plugin class AntRunner. When i run it outside eclipse using the folow code it works.

Project project = new Project();
ProjectHelper helper = ProjectHelper.getProjectHelper();
project.addReference("ant.projectHelper", helper);
setup(projeto); // sets script properties
helper.parse(projeto, new File(buildDirectory + "build.xml"));
projeto.executeTarget("deploy");

I tryied to use AntRunner and i got an IllegalStateException from AntX.

AntRunner runner = new AntRunner();
runner.addUserProperties(mapaPropriedades);
runner.setExecutionTargets(new String[] { "deploy" });
runner.setBuildFileLocation(buildDirectory + "build.xml");

try {
runner.run();
} catch (CoreException e) {
Platform.getLog(Platform.getBundle("DeployerRCP")) .log(
Status(Status.ERROR, "SISBRDeployer", e.getMessage()));
throw new RuntimeException(e);
}

org.eclipse.core.runtime.CoreException: c:\projetos\DeployerRCP\build\build.xml:31: The following error occurred while executing this line:
c:\projetos\DeployerRCP\build\build.xml:72: java.lang.IllegalStateException: VERIFY: jware.svn4ant.SvnCheckoutTask: execute- task in live project
at org.eclipse.ant.core.AntRunner.handleInvocationTar getException(AntRunner.java:452)
at org.eclipse.ant.core.AntRunner.run(AntRunner.java: 384)
at org.eclipse.ant.core.AntRunner.run(AntRunner.java: 475)
at br.com.bancoob.sisbr.infraestrutura.deployer.Deplo yer.deploy(Deployer.java:133)
at br.com.bancoob.sisbr.infraestrutura.deployer.wizar d.DeployerRunnable.run(DeployerRunnable.java:89)
at org.eclipse.jface.operation.ModalContext$ModalCont extThread.run(ModalContext.java:121)
Caused by: c:\projetos\DeployerRCP\build\build.xml:31: The following error occurred while executing this line:
c:\projetos\DeployerRCP\build\build.xml:72: java.lang.IllegalStateException: VERIFY: jware.svn4ant.SvnCheckoutTask: execute- task in live project
at org.apache.tools.ant.ProjectHelper.addLocationToBu ildException(ProjectHelper.java:541)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java :418)
at org.apache.tools.ant.taskdefs.CallTarget.execute(C allTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(Unknow nElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execut e(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:35 7)
at org.apache.tools.ant.Target.performTasks(Target.ja va:385)
at org.apache.tools.ant.Project.executeSortedTargets( Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project .java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.execut eTargets(DefaultExecutor.java:41)
at org.eclipse.ant.internal.core.ant.EclipseDefaultEx ecutor.executeTargets(EclipseDefaultExecutor.java: 32)
at org.apache.tools.ant.Project.executeTargets(Projec t.java:1181)
at org.eclipse.ant.internal.core.ant.InternalAntRunne r.run(InternalAntRunner.java:623)
at org.eclipse.ant.internal.core.ant.InternalAntRunne r.run(InternalAntRunner.java:456)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.ant.core.AntRunner.run(AntRunner.java: 378)
... 4 more
Caused by: c:\projetos\DeployerRCP\build\build.xml:72: java.lang.IllegalStateException: VERIFY: jware.svn4ant.SvnCheckoutTask: execute- task in live project
at org.apache.tools.ant.dispatch.DispatchUtils.execut e(DispatchUtils.java:115)
at org.apache.tools.ant.TaskAdapter.execute(TaskAdapt er.java:134)
at org.apache.tools.ant.UnknownElement.execute(Unknow nElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execut e(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:35 7)
at org.apache.tools.ant.Target.performTasks(Target.ja va:385)
at org.apache.tools.ant.Project.executeSortedTargets( Project.java:1329)
at org.apache.tools.ant.helper.SingleCheckExecutor.ex ecuteTargets(SingleCheckExecutor.java:38)
at org.eclipse.ant.internal.core.ant.EclipseSingleChe ckExecutor.executeTargets(EclipseSingleCheckExecut or.java:30)
at org.apache.tools.ant.Project.executeTargets(Projec t.java:1181)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java :416)
... 26 more
Caused by: java.lang.IllegalStateException: VERIFY: jware.svn4ant.SvnCheckoutTask: execute- task in live project
at com.idaremedia.antx.AssertableTask.verifyInProject _(AssertableTask.java:296)
at com.idaremedia.antx.AssertableTask.verifyCanExecut e_(AssertableTask.java:329)
at com.idaremedia.svn4ant.client.solo.SnapshotTask.ve rifyCanExecute_(SnapshotTask.java:235)
at com.idaremedia.svn4ant.client.solo.SvnCheckoutTask .execute(SvnCheckoutTask.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execut e(DispatchUtils.java:105)
... 41 more

Discussion