How to add properties file to classpath in Grails - grails

What does it mean when it says to add a file to the classpath? Something like this:
// The configuration file we created. It must be in the classpath.
outEncryptionProps.put(WSHandlerConstants.ENC_PROP_FILE, "client_encryption.properties");
I use GGTS and I have other files other than properties file that I need to add to my project's classpath.

The classpath is a collection of jars and directories that are used to resolve classes and resources. In practice for files like this putting them in the classpath means that you should put it in a directory that's included in the classpath, or a directory whose contents are copied to a classpath folder during compilation.
In Grails you can put non-source files in grails-app/conf, src/java, or src/groovy and they'll be copied into the classpath.

Related

how to Include a folder and files in META-INF folder when creating the jar using ant task

I need a way to include a folders and files inside the META-INF directory when creating a jar using ant task.
Currrently I am using <metainf> tag , which is only including the files but not the folders.
Can anyone please help me.
Add new folder TEMP-INF under src\main\java
Put all the files and folders, which you wish to include in your JAR's META-INF into this newly created TEMP-INF
Now open build.xml file and search for
<jar> </jar> tag
Add <metainf dir="src/main/java/TEMP-INF"/> into <jar></jar>
And its done.

How to add custom Grails plugin artefact directory

I have a Grails application and a custom plugin with separate code included in the main application in BuildConfig.groovy using grails.plugin.location.'my-plugin' = '../my-plugin'. Now I'm looking for a way to customize what artefact directories will be exported in the plugin. I want to place a custom resource file (e.g. SQL script) into src/resources directory of the plugin and I need to see the file on classpath of the main application. I know files in grails-app/conf and other directories get included along with the plugin source, but can the convention of resource directories be altered?

Grails - How to include subdirectories of lib in classpath?

I have an application deployed and I need to include new jars during runtime.
I am currently doing it by placing the jars in the lib directory, but if I place them in some subdirectory of lib they are not loaded.
Is it possible to do it?

Delete generated files when original is modified with Apache Ant

I want to delete the generated files (".tmp" and ".bak") in the build directory when the source file (".xml)" is modified with Apache Ant. All files have the same name, but different extentions.
I'm not able to create the fileset to do this.
You can use a file mapper in place of a fileset.

How to specify the jar file in manifest?

I have created a mail.jar file and mywar.war file. What I need to set into the manifest.mf use the mail.jar as a library?
You don't use a MANIFEST.MF to put a jar in the classpath of a war file. You just put it into WEB-INF/lib in the war file.
Class-Path: ../relative/path_to_/mail.jar
EDIT:
Note: The relative path should be with reference from the directory where your program is starting.

Resources