In Teamcity I'm kicking off an Ant Build. I want to add additional jars to the classpath, including ant-javamail.jar
How do I specify these in the settings control panel?
Can you specify "-lib /path/to/ant-javamail.jar" in the "Additional Ant command line parameters:" of your Ant Runner's configuration in TC?
References:
http://ant.apache.org/manual/running.html
http://confluence.jetbrains.net/display/TCD5/Ant
Related
I have a problem with the configuration in an ant project at jenkins with sonar. For to establish a ant project with sonar at Jenkins it's necessary to indicate the properties: sonar.projectVersion, sonar.projectName, sonar.projectKeys, sonar.binaries, sonar.libraries and sonar.sources. I would like knowing if it's possible to establish the projectVersion and projectName in the file build.xml or build.properties and to indicate in the sonar that it takes the value of these properties. For example:
build.properties (or build.xml):
project.name=XXX-XXX-XXX
project.version=2.0.3
Sonar configuration at Jenkins:
sonar.projectName=${project.name}
sonar.projectVersion=${project.version}
Thanks and sorry for my english.
This is not possible yet, but feel free to vote for https://jira.codehaus.org/browse/SONARUNNER-76
In eclipse, I can tell my external ant tool to run with stuff in the classpath.
If i want to run ant from the command line, how would i do that?
For argument's sake, the classpath i want to add is c:\some\folder\here\hooray.jar
Use the -lib argument. From the Ant docs on this page:
Additional directories to be searched may be added by using the -lib option. The -lib option specifies a search path. Any jars or classes in the directories of the path will be added to Ant's classloader.
I'm trying to Gradle-ize our build by using Gradle to execute the Ant build. I'm using the java plugin so I can set source/target and I'm using ant.importBuild 'build.xml'. When I execute Gradle, I get the error above. I understand that both Ant and Gradle have these targets/tasks in common: clean, jar, javadoc, test. One option is to change the Ant target names in build.xml, but I'm hoping there's an easier way as I have a lot of projects and build files. I found this "wrapper" solution (http://issues.gradle.org/browse/GRADLE-771), but this did not work for me. How can I solve this?
Your options are:
Do not apply the plugin to the same project that imports the Ant build.
Rename the conflicting targets in the Ant build script.
You can rename all the ant targets:
ant.importBuild('build.xml') { String oldTargetName ->
return 'ant_' + oldTargetName
}
I'm converting our build from Ant to Gradle. Our first step is to add the Gradle build files so we can start using Gradle as our build tool. This lets us use our existing build scripts to build using Ant and convert them to Gradle over time. I want to simply have Gradle call the existing Ant build files. Our projects are all NetBeans projects, which have build.xml and nbproject/build-impl.xml files. Some of the projects require NetBeans build properties, which can be found at ~/.netbeans/6.5.1/build.properties. I currently have build.gradle which contains only this:
ant.importBuild 'build.xml'
I can build the project using Ant like this:
ant -Duser.properties.file=/home/me/.netbeans/6.5.1/build.properties dist
However, when I build with Gradle, Ant complains it cannot find the properties set in build.properties. I've tried setting the Ant property, but it doesn't seem to get picked up:
ant.properties['user.properties.file'] = '/home/me/.netbeans/6.5/build.properties'
I've also tried setting a system property:
systemProperties 'user.properties.file': '/home/me/.netbeans/6.5/build.properties'
but this doesn't work either. Ideally I'd like to set this property in ~/.gradle/gradle.properties as just about all of our projects need it.
How can I set this property in Gradle and have Ant pick it up when called from Gradle?
If you want to set load the properties on multiple Gradle projects you could use a Gradle init script, http://www.gradle.org/docs/current/userguide/init_scripts.html. Inside the init script you would put this code:
allProjects {
ant.properties['user.properties.file'] = '/home/me/.netbeans/6.5/build.properties'
}
I know that, we can very well use ANT and Maven together to build the project.We can run ANT scripts through Maven's POM.xml. But my question is can we run pom.xml through ANT's build.xml ?
i.e. can we create maven build from build.xml
Yes, using maven ant tasks.
The page lists out multiple maven tasks which can be integrated into an ant build script, thus combining the features of both. To take an example, there is the mvn task, which as documented can do a full maven build from ant.
<artifact:mvn mavenHome="/path/to/maven-3.0.x">
<arg value="install"/>
</artifact:mvn>
Besides this, there are
Dependencies task
Install and Deploy tasks
Pom task
each described with examples.
Maven and ANT are very different build tools. In ANT you write all the logic yourself, whereas a standard build process is "baked in" with Maven.
The POM file contains no logic, instead it contains a series of declarations about your project.
If you understand well how Maven works, it is theoretically possible to take a POM and generate an ANT build that emulates the behaviour of the Maven build. I'm not aware of any solution which can easily convert in the other direction, mainly because ANT is missing Maven functionality, such as dependency management.
Instead of trying to convert an ANT build into Maven, I'd recommend that you keep your existing build logic and delegate the management of your classpath to the ivy or Maven ANT tasks. These tools also provide tasks to publish your build output to a Maven repository, enabling your project to share with other projects using Maven.
Finally, I'm an ivy advocate and wrote an ant2ivy script which can assist in upgrade process. It creates an initial set of configuration files for downloading your projects dependencies from the Maven central repository.