Grails 3.1.5 dont produces jar file - grails

In version to 3.1.5, the command "package" not produces a jar file in "project/build/libs"
I ran a simple "create-app" and "package" with versions 3.0.9 and 3.1.5. Only the first produces a jar file. No error appears in both.
Someone knows how I create a executable JAR, in version 3.1.5?

The documentation states...
If you prefer not to operate a separate Servlet container then you can
simply run the Grails WAR file as a regular Java application.
And then provides the following example:
grails war
java -Dgrails.env=prod -jar build/libs/mywar-0.1.war
So basically, the generated war file is a jar file.

Related

How to exclude grails plugin jar from war file

Grails 3.2.5. Build.gradle has mail plugin:
compile "org.grails.plugins:mail:2.0.0.RC6"
In deploying a war to production I need to remove javax.mail-1.5.6.jar from WEB-INF/lib since that jar must be in the Tomcat lib when using a JNDI mail resource. So how do I keep the mail plugin but remove the offending jar file from the war? I knew how to do this in Grails 2.x. Via the gradle war task in build.gradle I have tried to exclude the file (doesn't work - the jar drifts in from a plugin somehow), and have tried to filter the file out. When I build the war I get two files - "app-0.1.war" and "app-0.1.war.original". The "original" file has the WEB-INF/lib/javax.mail jar filtered out, but the real, complete war still has it.
So how do I prevent that plugin jar from getting into the war file? Thanks.
One way to do it is with something like this:
war {
rootSpec.exclude '**/javax.mail*.jar'
}
(you may need to adjust depending on whether or not you want to also exclude the javax.mail-api jar file along with the javax.mail jar)
See https://github.com/jeffbrown/excludejar/blob/67734ac0c65cdbead468f1e65bcfc29041cd2279/build.gradle#L70-L72

Create war file in grails using GGTS

I have done a small application in Grails, and now I need to generate a war file to test it on server. I generated a war using command grails:war. It has generated the file but named it as myapp-01.war. I don't want this, I need a war where the file name should be same as the project; like myapp.war
Try:
grails war myapp.war
Additional options: http://docs.grails.org/3.1.1/ref/Command%20Line/war.html

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 grails 3.0.x create custom war name with different file suffix

In grails 3.0.(1,2,3) the war file exist under the folder 'build/libs'
However, I want to rename the war name with different file suffix, like "app.tar.gz", without the version.
the google result is all about grails 2.x
I put the grails.project.war.file = "target/${appName}.tar.gz" in the file application.groovy under the folder conf but it's useless.
Plz help me, i googled and try to find solution in the source code BuildSettings.groovy, but the it's no use.
As of grails version 3, the build tool is gradle, you would need to change those parameters from your build.gradle file
If you do not want the version as part of your package name, you will need to comment (or remove) the version from build.gradle file
for example, running the following
fhenri#machine:~/project/grails/sample307$ grails -version
| Grails Version: 3.0.7
| Groovy Version: 2.4.4
| JVM Version: 1.8.0_51
fhenri#machine:~/project/grails/sample307$ grails package
...
fhenri#machine:~/project/grails/sample307$ find . -name *.war
./build/libs/sample-0.1.war
After you remove the version from `build.gradle` file
fhenri#machine:~/project/grails/sample307$ grails package
...
fhenri#machine:~/project/grails/sample307$ find . -name *.war
./build/libs/sample.war
Grails uses the war gradle plugin, from the plugin the pattern to make the archive name is [baseName]-[appendix]-[version]-[classifier].[extension], the version already comes from the build.gradle file as generated from grails create-app
each of this can be overwritten in a war closure, for example, an excerpt of the build.gradle could be
version "0.1"
war {
appendix "so-test"
version "1.0"
}
The generated war file will be sample-so-test-1.0.war the version will come from the war closure.
So if you want to keep the mail version properties but do not want to generate the version in your generated war name you can overwritten the property with an empty value
version "0.1"
war {
version ""
}
will generate a war file without the version information, but still you could keep it for you if you want to use it somewhere else.
To package as tar/zip, you can
follow the documentation for grails 3: http://grails.github.io/grails-doc/latest/guide/deployment.html (chapter on TAR/ZIP distribution)
In build.gradle, after applying the gradle war plugin you can do this:
war {
archiveName = "ROOT.war"
}
And a ROOT.war file will be created at build/libs

Can a Rails plugin be packaged as a WAR/JAR file?

Can a plugin be packaged as a JAR/WAR file similar to the way in which an entire Rails app can be packaged for deployment on JRuby?
either you want warbler or you want to make a jar.
If you need an empty rails app with that plugin, create an empty project, install the plugin and, edit config/warble.rb to copy the gems you need
If you need a jar with class files from that plugin; you need jrubyc to compile the rb files to class files that you can then turn into a jar with the java jar command. Put that jar into WEB-INF/lib of any Java app that needs those ruby classes.

Resources