Downloaded Ant and set it up successfully, however when I run from command line I see the following:
C:\>ant
Buildfile: build.xml does not exist!
Build failed
http://pastebin.com/pkHiPnHi
I want to build a JAR file and then invoke that file. Do I just need to bring the build.xml file, containing my project, into my new Ant directory?
Check how to write a simple build file :
http://ant.apache.org/manual/using.html
Related
I haven an Grails 3.1.8 application and building an executable jar file, which runs fine. Now I wanna upload the produced jar file to my maven repository by using the gradle maven plugin. Here the problem begins. The upload tasks uploads the wrong JAR file.
If I execute 'grails assemble' two files get produced:
100032 mcc-1.0.9.jar
4880 mcc-1.0.9.jar.original
As you can see, the first file having the bigger size is obviously the fat jar file, which works fine. After the assemble task the 'upload' task is executed and uploads the smaller file. I tried also to define the artifact:
artifacts {
archives file: file("build/libs/mcc-1.0.9.jar")
}
Then the fat jar get overwritten or is not produced at all:
4880 mcc-1.0.9.jar
4880 mcc-1.0.9.jar.original
and the small JAR gets uploaded again. How can I force gradle to take the fat jar file or at least produce only the correct file?
Thanks to Hubert Klein who answered my question in the comment section of this article: https://dzone.com/articles/grails-goodness-creating-a-fully-executable-jar.
This happens because the uploadArchives task depends on the jar task by default. But then the bootRepackage task is not executed, that actually overwrites the jar file with the full executable jar file.
If you add to your build.gradle file that the task uploadArchives depends on the assemble task the bootRepackage task is invoked before uploadArchives:
uploadArchives.dependsOn(assemble)
I had the same issue
gradle clean build assemble artifactoryPublish
Using IntelliJ 14, I successfully generated Ant XML from what was in the Project Structure Artifacts GUI. I can run Ant targets and have successfully modified the Ant XML. Now Build -> Make Project gives me pre-ant-modification results. I expected IntelliJ to use or stay in sync with the Ant XML after generating it. Is there a way to get that effect?
No, there is no way to import the modifications of an Ant file into the IntelliJ IDEA project model. IntelliJ IDEA's build does not use Ant in any way, and in general the structure of Ant files is much more general than what's supported by IntelliJ's project model.
What you can do is stop using IntelliJ's Make Project action and always build your project through Ant from IntelliJ. To do this, run "Add as Ant build file" action on your generated build file, and run build actions from the Ant toolwindow. Then, in your run configurations, you can replace "Before launch: Make" with "Before launch: Run Ant target".
this is a batch file that i have. It is located in C:\Work\6.70_Extensions\Lab Tools\ folder.
ANT.BAT:
set CLASSPATH=%CLASSPATH%;.;c:\JavaMail\javamail-1.3\mail.jar;c:\JavaMail\javamail-1.3\mailapi.jar;c:\JavaMail\javamail-1.3\pop3.jar;c:\JavaMail\javamail-1.3\smtp.jar;c:\JavaMail\jaf-1.0.2\activation.jar
CALL "C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat"
#echo on
%ANT_HOME%\bin\ant -logger org.apache.tools.ant.listener.MailLogger -q -buildfile "Master Build.xml"
pause
along with ant.bat, i have a Master Build.xml file located inside the same folder.
When i double click on ant.bat, it will execute the Master Build.xml ant script properly.
However, whenever i try to use another application to open the batch file's absolute path, it always state that Master Build.xml file does not exist!
I tried to open the absolute path using both console application and another ANT Script(via Cruisecontrol framework) but both gives the same error. What is the error here?
for your information here is what ive done with cruisecontrol:
create config.xml (to set intervals for builds)
create nightbuild.xml (so that config.xml will go into it to perform required tasks)
nightbuild.xml will run several console applications to sort files, checkout files from version control etc
lastly, nightbuild.xml will execute ant.bat file to execute the build
These files, config.xml and nightbuild.xml are found in C:\build
When you execute from a directory other than the one containing Master Build.xml, Ant will fail to find the build file, which it expects to be in the current working directory.
You could set an additional environment variable to specify the path to the build file, e.g.
%ANT_HOME%\bin\ant -buildfile "%MASTER_BUILD%\Master Build.xml"
If you set your variable to an absolute path (e.g. C:\Work\6.70_Extensions\Lab Tools) then it will always work. If you use a relative path (e.g. .\Lab Tools), then it will only work if executed from the relative root dir.
(BTW, life will probably be easier if you use buildfiles without spaces in their names, e.g. master_build.xml rather than Master Build.xml).
I am using Apache Ant scripts for building a web application. I have written some targets in the build.xml file and the script is running fine. I remember using just "build" command to run ant build instead of "ant build". Can anyone tell me how is that achieved? I was a bit curious on this.
There's no built in "build" command. You could create a simple script file called "build" in the same directory that launched the ant build.
Create a text file with this as the contents:
ant build
In windows save this as a file called build.bat then you can just type build from the command line to start your build.
On unix or linux, save the file as build, then make it executable (with chmod +x build). You'll need to type ./build to get it to run.
I don't think there's a lot of value doing this to replace the simple case of ant build, but if you have to regularly run a build that has multiple targets, or need to pass in certain system variables then it could come in useful.
Maybe your are remembering typing "ant" instead of "ant build" in the past. This is possible to setup. You just need to set default attribute on the root project element in your Ant script to the name of the target you want invoked when an explicit target isn't specified.
For instance...
<project name="myproj" default="build">
...
</project>
I am trying to build subprojects from my main Ant build script..
The build files are located in
plugings/<pluginName>/build.xml
I want to do something effectively like
<ant antfile="plugins/*/build.xml" ...>
It should dynamically find build files in the plugin directory. Haven't been able to get it to work yet with filesets.. any tips?
Thanks in advance.
Solution: <subant> was the task I was looking for
These links show you a way of building sub-projects:
Sample Ant build file for multiple projects
Ant Tip 1: Write a master build file
Check this answer:
Generate Ant build file