grails doesn't generate ant build file - grails

I'm a beginner of Grail. I learned from the quick-start tutorial that the grails create-app will generate a build.xml for Ant.
I execute the command. but couldn't get the build.xml file. Is there missing any steps? Any help is appreciated.

As Don said you really don't need it. But if you want the build.xml that used to be automatically created, run
grails integrate-with --ant
See http://grails.org/doc/latest/ref/Command%20Line/integrate-with.html

Grails may generate a build.xml file "under the hood", but there's no reason for you to worry about this, because you don't work with Ant directly when developing with Grails. Instead you use Grails commands (like create-app) to create, build, test, deploy, etc. Grails applications.
The create-app command creates a new application. To run the application, execute the command grails run-app from the root directory of the project.

Related

Grails Multi-Project: Running a Plugin's custom script

Followed the tutorial on multi-projects
Everything mostly works. Plugin controllers & domain classes load properly in the application. However, a problem occurs when trying to run a Plugin's custom script from the application's grails CLI.
For example:
If you set up the multi-project directory structure like this:
Project Root
Application Directory
Plugin Directory
settings.gradle
And ran this command from the Plugin Directory
grails create-script hello
You'd be able to access the script when running grails from the Plugin Directory, but not the Application's Directory.
Is there a way to get this to work properly? Do I need to use an alternative set up?
Also see Creating a Custom Script in Grails
A conventional grails 3 plugin is different than a plugin within a multi-project. It doesn't seem to be designed to compile a plugin such as grails scaffolding with custom commands.
For this reason, you should package the plugin manually using:
grails package-plugin
grails install
Now in the build.gradle, add this line to dependencies:
compile "<plugin-group>:<plugin-name>:<plugin-version>
Subsituting the appropriate information within the brackets <>.
You can find the plugin-group in the plugin's build.gradle
group "org.grails.plugins"
plugin-name you specified in the grails create-plugin command
grails create-plugin plugin-name
plugin-version is also found in the plugin's build.gradle
version "0.1"

Build a new Grails app by Gradle

I get a company's project from Github, and import into the GGTS as a gradle project. Everything runs OK. gradle task show this.
I want to create a new Grails app, so I used the command grails create-app wtf, and then import into GGTS as a Gradle project. What make me confused is that the file named build.gradle or the folder named .gradle do not appear, gradle task shows null like this, while I do the same thing in system of company and it runs fine.
Please tell me what happend? And I did not write a build.gradle in system of company manually.
The problem is Grails 2.4.4 does not use Gradle. That didn't start until Grails 3.0.
I believe you need to import the project as a Grails project (I haven't used ggts in a long time, so my recollection it's foggy). You can read more about IDE integration here.

How do I compile grails project using grails command line?

How do I compile my grails project? I want to get a .war file so I can deploy it.
First I installed JDK then I installed grails and I have properly set environment variables for both and checked it.Now I want to compile this grails project using grails command line.how can I do it?
Thanks in advance
If you type "grails help", you'll get a list of all the grails commands. The one you're looking for is "grails war"

Apache Ant argument to generate portlet only

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.

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