projects_default.yml file in thorntail - thorntail

Thorntail generator does not generate any project_defaults.yml file in project structure. No resources folder also seen.Should we manually place this file to configure project properties?
Note : I am new to thorntail.

Yes, you need to create a file project-defaults.yml inside src/main/resources.

Related

how can I modify Implementation-Version in manifest file?

my project uses spring core-Implementation-Version: 5.0.10.RELEASE in all packages
I want to change it to 5.3.24 in all packages.
I searched "5.0.10.RELEASE" in project and it is written only in manifest file.
So I thought I need to change the Implementation-Version in MANIFEST.MF in spring-core-5.0.10.RELEASE.jar
How can I do that?

Add a file to a specific folder with gradle build

I am currently working with a project (using gradle) that needs a properties file in the same package to the class that consumes it (I can't change this config). I have added the file in my package, but when I execute the gradle build command omits the file, and only adds the .class file. The app is deployed as a war file.
I have tried editing the war task, but I can't find the way to make the properties file to be added:
war {
from('src/main/com/foo/bar') {
include 'b.properties'
into 'WEB-INF/classes/com/foo/bar'
}
}
The war task does execute (I have added a prinln and it executes). Also, I have tried changing the paths, but no results. Also replacing from('path') to from (file('path')), but still doesn't seem to add the file anywhere.
How should I achieve this? Thanks!
Is there anything stopping you from following Gradle's convention for resources?
Eg put your property file at src/main/resources/com/foo/bar/b.properties
If you do this you won't need any task customisations

Spring Boot how to add another resources folder in test folder

Is it possible to add another resources folder in test folder, which will also be on the classpath?
I need it because I don't want to add application-test.properties file in default resources folder because it belongs in test folder.
I tried to add folder manually but it does not work.
I soloved this problem, in Intellij IDEA by:
Right clicking on the project -> Projectu structure,
and I marked newlycreated folder as Resources file.
It is gradle project or maven? If you have gradle just add the line below to the build.gradle file:
ext {
resourcesDir = projectDir.path + "/other/resources"
}
where the /other/resources is your dedicated resource folder

Spring Boot on Tomcat set file Paths in properties file

I want to set my relative file path in a properties file so my SaxReader can pick it up when it runs on Tomcat server. I know this should be easy but I've forgotten forgive me :)
I know Spring Boot has application.properties file but I don't see a way to hook in here.
Is there a way to set the relative path in a properties file that will get picked up by Spring Boot and the SaxReader will see it?
As it is I'm hard coding just the filename and putting the file in the resources folder that serves up the templates and static content such as css and js files. The filePath system.out gives: org.dom4j.DocumentException C:sts-bundle\sts-3.7.2.RELEASE\myFileName the toolsuite root location??? weird!!
Please tell me how to specify the relative path in a properties file.
Thanks!!
You can set the file path like any other string property in Spring Boot properties file and access it from inside the path.
E.g. I have the following set in my application.properties file:
download.directory=temp
and it is used as follows in java class:
#Value("${download.directory}")
private String downloadDirectory;
It is used to download the files, now, if I start the application with jar file present in let's say G:/applications folder then the files will be downloaded into G:/applications/temp.

How to add META-INF/context.xml in Warbler

How can I add META-INF/context.xml into the war? I didn't find any config entry in config/warble.rb.
Unfortunately Nick's method doesn't work. The file is actually copied to WEB-INF/META-INF/context.xml.
I finally figure out a way to copy context.xml to META-INF:
create META-INF/context.xml under your rails app root folder
uncomment and change the following line in config/warble.rb
config.public_html = FileList["public/**/*", "doc/**/*", "META-INF/context.xml" ]
Basically treat META-INF as public_html, and it will be copied to webapps/youapp/META-INF.
You'll have to add one yourself. You can either create a META-INF/context.xml directory and file in your project and add META-INF to config.dirs in config/warble.rb or you can add a "pathmap" to rename the context.xml file into the META-INF directory in the war file.
config.pathmaps.application += ["%{context.xml,META-INF/context.xml}p"]
A better way of tackling this might be to use the following in your warble.rb file.
config.script_files << 'path_to_file/context.xml'
See documentation towards bottom of https://github.com/jruby/warbler/blob/master/lib/warbler/config.rb
# These file will be placed in the META-INF directory of the jar or war that warbler
# produces. They are primarily used as launchers by the runnable feature.
attr_accessor :script_files

Resources