I've looked at http://ant.apache.org/manual/Tasks/retry.html and it doesn't list the necessary jars to ensure that the following error doesn't occur:
build.xml:80: Problem: failed to create task or type retry
This is what my code currently looks like:
<retry retrycount="5">
<javaTask variable="${host}" variable2="${user}" variable3="${pass}"/>
</retry>
You need Ant version 1.7.1 or better to utilize retry. Per the documentation:
Retry is a container which executes a single nested task until either: there is no failure; or: its retrycount has been exceeded. If this happens a BuildException is thrown. Since Apache Ant 1.7.1
Related
From Eclipse mars version, pom.xml - Run As - maven clean and i got the following error message with Build Failure.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project testing-framework:
Execution default-clean of goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean failed: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved:
Failed to collect dependencies at org.apache.maven.plugins:maven-clean-plugin:jar:2.5 -> org.apache.maven:maven-plugin-api:jar:2.0.6:
Failed to read artifact descriptor for org.apache.maven:maven-plugin-api:jar:2.0.6:
Could not transfer artifact org.apache.maven:maven-plugin-api:pom:2.0.6 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.maven.apache.org -> [Help 1]
I had the same problem. I solved it by killing java.exe process in Task Manager and re-excuting maven clean install.
Unknown host repo.maven.apache.org
sounds like a networking issue. Maybe check wether you need to supply proxy information within your settings.xml. Here's the documentation on how to supply one.
Alternativly, Eclipse might expose its own proxy settings to its Maven integration, but I'm not sure about that, I only use Maven from console. Still, its worth the check and maybe the config.
If a plugin defines a series of tasks, is it possible to inject a dependency into these, such that the dependency is called before the plugin-defined task is executed?
The native-artifacts plugin defines buildNar (and buildNarxxx, where xxx is the platform config) tasks. It also defines extractNarDepsxxx (where xxx is the platform config for the Nar to be built). extractNarDeps is not called before builder, so the build fails as required dependencies are not downloaded prior to the attempted build.
How do I inject extractNarDepsxxx as a dependency into buildNarxxx?
Ok. Consider the following example:
apply plugin: 'java'
task someTask
task anotherTask
tasks.classes.mustRunAfter(anotherTask)
tasks.build.dependsOn(someTask)
There's a single plugin applied java and two custom tasks someTask and anotherTask.
Task build (taken from java plugin) dependsOn someTask. It means that when You run gradle build this task will be executed.
Task classes mustRunAfter anotherTask. So when You type gradle build anotherTask, anotherTask will run before build.
Try it. An ask further questions when needed.
I'm trying to integrate custom PMD tasks in Sonar, which I currently managed to work along with Sonar PMD plugin.
My current issue is to run sonar ant task with the command line.
In my eclipse workspace, I add additional classpath entries in Eclipse for Ant to run and it works just fine.
But when i run it in the command line, no matter how I pass the jars for ant, it just doesn't seem to be using it in the ClassLoader.
This is a big issue for my project, once I can't put the task to run in my continuous integration server.
I'm currently passing the jar's that contains all the classes need using the property sonar.libraries.
The error I'm getting is:
build.xml:121: java.lang.NoClassDefFoundError: net/sourceforge/pmd/AbstractJavaRule
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
"sonar.libraries" references only dependencies of your application, not dependencies of Sonar execution context.
If you want to develop custom PMD tasks that will be used by Sonar, please have a look at this example plugin: https://github.com/SonarSource/sonar-examples/tree/master/plugins/sonar-pmd-extension-plugin
You just have to build the JAR of the plugin
Put it in your "/extensions/plugins" folder
And restart Sonar
I need to fork a new process for a specific ant task. I dont see a fork attribute in the taskdef how do I do it ?
I should be clearer, I am not talking about executing ANT in a forked process:
I have an ant task X, which I need to run in a forked process. Its some third party task which i use with taskdef X and then use this way
Is there anyway to tell any that anytime i use that task please fork the process and run ?
See Running Ant via Java in the Ant manual.
I'm having issues getting something which seems very basic running with Grails. I want to call grails commands from an Ant script - Grails provides a Grails task to achieve this. I have defined the Grails taskdef and classpaths as per the docs however, no matter what command I call I get the same error...
grails-compile:
[grails] Resolving dependencies...
[grails] Dependencies resolved in 1192ms.
BUILD FAILED
/java/grailstest/build.xml:22: Unable to start Grails: java.lang.reflect.InvocationTargetException
Even when I create a new Grails app using 'grails create-app' and then run the integrate ant command 'grails integrate-with --ant' to generate a default build.xml, I get the same error when running any of the tasks in the generated build.xml.
I've tested this with Grails 1.3.1, 1.3.4 and 1.3.5 and am getting the same error.
Has anyone else encountered this problem? There must be something stupid I'm doing wrong or this would never have made it out the door of the Grails factory... ;)
I forgot to mention that I am using Ant version 1.8.1. I have just discovered that switching back to Ant 1.7.1 'solves' this problem but this is not really ideal as I need 1.8.1 for other build tasks. I'll submit a bug on the Grails issue tracker as it seems a lot of people are having the same problem.
I've just found the same issue. It seems that Ant 1.8 is not supported yet (but Ant 1.7 is), see GRAILS-6897. Some users have complained that the documentation does not state it strictly.