Apache Ant argument to generate portlet only - ant

I'm working with Liferay and generating portlets with a Apache Ant-based build.
I want to generate a portlet project only without compiling it's codes.
How can I do it? What arguments must be passed to the ant command?

Just simply use the create.sh script that is in the portlets directory under the Plugins SDK to create a new portlet plugin project.
Install Plugins SDK
Go into portlets subdirectory on command line
Run the create.sh/create.bat and pass two arguments, one for name of portlet project and other for the display name.
All of this is fully documented here along with how to perform the same task using Liferay IDE (Eclipse plugin for Liferay development).

There are 2 files in the myProject-xmlportletfactory folder under the XmlPortletFactory folder: build.xml and myProject.xml.
When I run the ant in this path, it runs the build.xml.
In the buil.xml file, under the <target> tag there are to <ant> tags, the first builds services and classes for the project and the second compiles and deploys the project. if I delete the second tag and run the ant, it will build the project only and dont compile it.

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

Grails 2.5.1: use grails command-line tasks from binary plugin in lib folder

In Grails 2.5.1, is it possible to use grails command-line tasks from a binary plugin in the lib folder?
I had to modify an existing third-party plugin to get it to work properly.
I put the jar generated by the following command in my project's lib directory:
grails package-plugin --binary
When my project runs, it correctly uses my modified version of the plugin.
At build time, however, I need to run a Grails task on the command line that was provided by the plugin, but, using the binary plugin, the task does not appear to be available.
e.g., if the task was abc, when using the real plugin being referenced in the plugins section of BuildConfig.groovy, then I could run:
grails abc
Using the binary plugin in the lib folder, however, results in the task not being available from the command line.
Also, the original plugin hooked into grails war to include extra steps in the build process without changing the command line. These hooks no longer run with the binary plugin. Is there any way to reinstate the hooks for the binary plugin?
Thanks.

How to Open an Ant project (Nutch Source) at Intellij Idea?

I want to open Nutch 2.1 source file (http://www.eu.apache.org/dist/nutch/2.1/) at Intellij IDEA. Here is an explanation of how to open it at Eclipse: http://wiki.apache.org/nutch/RunNutchInEclipse
However I am not familiar with Ant (I use Maven) and when I open that source file many classes are not known by Intellij.
i.e.:
org.apache.hadoop.mapreduce.JobContext
org.apache.gora.mapreduce.GoraMapper
How can I add them to library or what should I do?
I finally figure out how to do it. Now our team can dev nutch in IntellIJ
The process we do
Get nutch source from apache.org
wget http://www.eu.apache.org/dist/nutch/2.3/apache-nutch-2.3-src.tar.gz
Import nutch source in intellij
Get Dependencies by Ant
Run ant runtime
Run ant test
Import dependencies into Intellij
File > Project Structures
Library > Ivy
Click to Plus button
Select all libraries in apache-nutch-2.3/build/lib
Now we have a project with nutch source and all dependencies
I think, you should use ant build for nutch project. Because, pom.xml is problematical for nutch. If you want to use it anyway maven, you check maven dependency in pom.xml .
I think, the problem can be solved with the following:
You create new project via idea and add nutch source. Idea is not
supported ivy ant project. You can install ivy plugin for idea, I
suppose, Idea12 does not support it.
or
You can create ant project for nutch via eclipse and then save
project. Then open the project on idea via eclipse classpath.
or
You can configure classpath. If you use ant build, you should add jars : File->ProjectStructure as follows:
Create a library
Attach Files
Then, if you use ant build, select jars from NUTCH_HOME/build/lib/* after build.
If you use maven build, select jars from ~/.m2/* (MAVEN_REPO)
Although Intellij supports running ant scripts directly through the IDE via the ant plugin, the Intellij editor will not figure out the classpath using your build.xml file by itself.This will result in the editor showing the code littered with errors.
Unfortunately the only solution I found to this is to add all the jars manually.You can get all the jars needed by building the ant project using the ant jar command.
So these are the steps you need to follow :->
1.Run ant jar command in the root of your program
2.Copy all the jars created inside the build folder(they will not be directly inside build folder.I had to go from build->ivy->lib->{project name})
3.Paste these jars to a new folder created somewhere outside the directory
4.Go to File->Project Structure->Libraries. Press the + button.
5.Select all the copied jars and press ok to any prompts which appear.
6.Press finish and wait for indexing to complete.Any dependency errors in the editor should resolve now.
Note: Since you are manually adding jars, you would need to keep them in sync if you change your build.xml file for any dependency change.
It seems that dependencies are managed using Ivy (see the ivy folder in the sources archives), so you could try to install the Ivy plugin, which would allow you to fix your classpath issues.

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.

Grails create-app does not produce build.xml?

It is said here that grails create-app should produce a build.xml for ant or maven. However it does not (at least in version 1.3.7). How can I build it with ant?
In order to allow your project to be built with ant you must tell it to integrate with ant. Use the following grails command from your project directory to do so.
grails integrate-with --ant
With net-beans ide you can run grails command throw the right click option of your project root folder, and select "run/debug grails command...".
Choose "integrate-with" command and put "--ant" as an argument.

Resources