Intellij's live inspection fails to find external references in ANT build files - ant

I have a project with different modules bundled into each others.
We build with ant and I have no problem running the Ant build inside Intellij if I provide the path to the generic build files through a property (repository.dir : C:/myRepositoryFolder).
Similarly, I have no problem running my ant build in command line given I have set my environment variable ANT-OPTS with -Drepository.dir=C:/myRepositoryFolder
However, Intellij does not know where to find this folder and therefore the inspection 'Ant inspections / Ant references resolve problems' blow off on most of my build.xml.
Does anybody know where I can show Intellij where to find this folder without modifying my existent build.properties?
Thanks in advance!

Related

Why is org-netbeans-modules-java-j2seproject-copylibstask.jar required failed ant build

When doing an ant build (thought jenkins) for a test project, I get the below error. As this test project will be deployed in tomcat why does the build require a netbeans specific module
Obviously I can add the jar file to a path in jenkins and then continue the build, but want to know why it needs a netbeans specific jar?
Is it because the project setup in Netbeans is wrong?
Thanks in advance.
Tony
======Error below here =========
var/lib/jenkins/workspace/DeployTest2/nbproject/build-impl.xml:797: The libs.CopyLibs.classpath property is not set up.
This property must point to
org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part
of NetBeans IDE installation and is usually located at
/java/ant/extra folder.
Either open the project in the IDE and make sure CopyLibs library
exists or setup the property manually. For example like this:
ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar

ant target doesn't exist but gets executed

i have never seen this strange -
i am into maintenance project where i got a build.xml and i never installed ant. ant is bundled into the project and so i use -
ant deploy_project.
but when i look at build.xml i cannot find any target named "deploy_project".
can anyone help me how the "deploy_project" target gets executed without this target being present in build.xml?
I suspect that since i didn't install ant by myself and is bundled with the project, any configuration of ant may have been overridden...but how to find it is where i am stuck, can any one pls help me?
(I am sure the target isn't present in build.xml).
thanks much in advance.
Run the following command:
$ ant -p
This will usually print out all the targets in your build.xml. Or at least the ones with descriptions.
Also look for <import file="..."> statements in your build.xml. These allow you to import other Ant build files which can contain targets that aren't in your build.xml. I suspect, if you do a search for the string deploy_project in your build.xml, and you can't find a target by that name, you have an import statement somewhere in your build.xml, so search for <import.
If you are SURE that the target is not present, and you are not specifying the build file with -f option, then only 1 explanation I can think of -
your ANT_HOME is somewhere else and there will be another build.xml there.
(Quickest way to check is find it - SET for Windows echo $PATH for Unix), find the value for ANT_HOME and in the same directory, a build.xml will be present with your *INVISIBLE* target
If you have searched the C: drive and still cannot find any build.xml, then the bundled ANT you have might be a customized one or an ANT wrapper. Meaning have a .bat file called ant.bat which accepts deploy_project as an argument and then maps it to another task using variable substitution. So look for a batch file ant.bat or anything titled ant.

Intellij IDEA, build artifact using Ant?

I might be missing something, but I have been struggling with this problem for some time now.
I have an Web application with Ant build script. I would like to set up an Artifact to this module, (which is the .war file, generated using ant), so that I could deploy this war file, to the configured Tomcat server.
But I am not able to figure out, how to make Intellij use my Ant script to build artifact. I see an option to Run Ant Targets, but this just runs the Ant target and Intellij then proceeds to generate Artifact, in the usual way.
Please let me know if the question is ambiguous. The problem is not Ant Integration with Intellij. I could just use the Ant window and run any target and also could make an Ant target run as part of Build. The problem is to associate an Artifact to a module and leverage the Ant script to build that artifact. I need this to enable, tight tomcat integration, Since while integrating the Tomcat server, I can specify an artifact to be deployed.
Note: Intellij IDEA version 11.1
IDEA can either deploy Artifact or the External Source (directory or file) that is built by Ant or any other tool:
It's not possible to associate IDEA Artifact with Ant build.

Can not compile Nutch1.4 with ant

all
I'm trying to deploy Nutch1.4 to Hadoop cluster(following this page). I got some problems when compiling Nutch with ant.
problem 1
When I run ant command, I got the following error:
/home/xenserver/apache-nutch-1.4-bin/build.xml:71: invalid Date syntax in "01/25/1971 2:00 pm"
I remove attribute "datetime" from line 71 in file build.xml and run ant again. Then I got another problem.
problem 2
The error is:
/home/xenserver/apache-nutch-1.4/build.xml:412: syntax errors in ivy file: java.text.ParseException: http://java.sun.com/xml/jaxp/properties/schemaLanguage in file:/home/xenserver/apache-nutch-1.4/ivy/ivy.xml
at org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser$Parser.parse(XmlModuleDescriptorParser.java:273)
........
What's wrong with the steps above? Is there any tutorial for compiling Nutch1.4?
Need your help.Thanks in advance.
For compiling nutch 1.4, all you have to do is run ant clean deploy from the nutch directory. The output is created in the directory named 'runtime' with 2 folders: one for local mode and other one for cluster mode.
please check the date settings and ant installation on your machine. I think that is casing the issue. Also have you tampered/ edited /home/xenserver/apache-nutch-1.4/ivy/ivy.xml ? Please check that file too.
EDIT:
There is some problem with the build file when executed on your Linux box.
Check these out: this and this.
These are the things that you should verify on your setup:
java version and ant version : dont use old ones. get the latest ones or ones that are compatible with your nutch release. FYI: for nutch-1.4 I am using apache-ant-1.8.3 and java jdk1.6.0_18. This combination works perfectly fine with me.
Check that you have installed a JDK and not a JRE
Check if your JAVA_HOME environment variable point to the JDK. System PATH variable must have $JAVA_HOME/bin and $ANT_HOME/bin appended to it. ANT_HOME variable must point to the ant installation directory.
Can you successfully run normal ant targets on any other build files ? try out with small ant build file.
Still facing the same issue, run ant command with -v option. This will provide more information about the error faced.
eg.
ant -v clean deploy

Building along with Project Dependencies in Ant

I have a Java project that is dependent on other Java projects that are siblings and there is a chain of dependencies. Each individual project has a build script written in Ant. For clarity find below a sample of the same.
EARProject depends on WebProject and EJBProject: The war file that is generated by the WebProject build and jar file that is generated by the EJBProject are needed to build the EARProject.
WebProject depends on ComponentOneProject: The jar file that is generated by the ComponentOneProject build is needed to build WebProject.
EJBProject depends on ComponentTwoProject: The jar file that is generated by the ComponentTwoProject build is needed to build EJBProject.
So, when I build the EARProject build, if the dependent war and jar have not been built yet, then it should kick-off the WebProject build and EJBProject build and if the ComponentOneProject is yet to be built, the build of ComponentOneProject needs to be kicked-off and so on.
Can someone suggest a clean method by which we can accomplish this?
Facing the same problem we at our company wrote a custom Groovy script that explores the full dependency tree ant generates the Ant build scripts based on all the .project, .classpath, .settings/* files. This wasn't as difficult as it might seem as first. This way we can build our products without (My)Eclipse on a clean CVS+JDK+Groovy virtual machine. Hope it helps..

Resources