How to use a properties file with ScalatraBootStrap? - scalatra

I'm trying to use a properties file not included in the app but specify it as a Java option during invocation.
something like
java -Dconfig.file=run.properties -jar app.jar
I am looking for suggestions on how can I send that property to ScalatraBootstrap when the app initializes.
Thanks
3

I figured that this is only possible if I use
com.typesafe.config.ConfigFactory

Related

SonarQube - How to use sonarRunner tasks / sonar.properties file globally with gradle wrapper for all projects

I am implementing sonarQube in one of my project.The source code is in java and all build files are written in gradle 2.3.My project is having 8 modules under same
repository and I am using the gradle wrapper while building the module.I checked in gradle wrapper for each module with module source code.while I trigger the build it checkout the gradle version(mentioned in wrapper properties file) from the artifactoryand use gradlew to build the artifact.
Below is mentioned in the wrapper properties files
Tue Mar 17 10:20:49 EDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://xyx.n.tson.com\:9000/artifactory/ext-release-local/org/gradle/gradle/2.3/gradle-2.3-bin.zip
while it checkout it creates a wrapper/dist in workspace in below manner(Using Jenkins)
wrapper/dists/gradle-2.3-bin/7gkccujig8oqm5bun82efob8m7/gradle-2.3/init.d/
Now I want to implement the sonar and for that I need to create global sonar.properties file or better add a section for sonarRunner Gradle task (containing all the sonar.xx.xx properties) where I can keep all the configuration and use it globally . I don't want to write the properties for each module.Can someone tell me if I am using the gradle wrapper where I can keep this property file and make it global for all modules instead of changing or creating the property file for each module.
I would put this file somewhere near your rootproject instead of having it with the wrapper itself. I would put it under $rootproject/gradle/sonar/sonar.properties)
from your build script you can reference this file via
rootproject.file("gradle/sonar/sonar.properties")
cheers,
René
If what you want is a non intrusive way to activate sonarqube plugin on your project (ie without doing a modification of build.gradle) then I have no idea of how to do that.
But if you want a way to pass properties configured in global Jenkins configuration (like server URL and credentials) to your build, then you should follow this ticket as this is a known limitation:
http://jira.sonarsource.com/browse/SONARJNKNS-217

SocketUseSSL property in config file for quickfix c++

I've noted that SocketUseSSL is not respected in c++. I have a quickfix engine (acceptor) with ssl. And I am trying to connect to it via quickfix c++. I added SocketUseSSL=Y property to the config file but it is not respected.
Are there any other properties I need to use in conjunction with the SocketUseSSL ?
I wrote my own ssl proxy with openssl but I was checking just in case if we can use this option.
I managed to answer my own question.
There are no SocketUseSSL property in config file for quickfix c++ as of now. I logged https://github.com/quickfix/quickfix/issues/31 to address the issue.

Gradle Jetty plugin locking files

Is there a way to fix the file locking issue caused by jetty entirely from gradle?
Some clarification:
When using the Gradle Jetty plugin by running gradle jettyRun, jetty causes the static resource files (html, css, js, etc.) to be locked when using Windows.
You can see a description of the problem in Files locked on Windows.
The same article also describes how you can fix that. Basically you have to either:
Disable the use of file mapped buffer
Not use NIO at all.
Both things require to add some jetty specific configuration files to the project, which I do not want to do - the jetty plugin is used only for convenience, and maintaining configuration for it does not feel right.
I do not need NIO for testing on the local machine, so any solution works.
Edit:
For now, I picked the option at which you set useFileMappedBuffer to false. This is how to do it:
Specify a path to your webdefault.xml like
[jettyRun, jettyRunWar,jettyStop]*.with {
//other configs
webDefaultXml = file("${project.webAppDir}/WEB-INF/jetty-webdefault.xml")
}
Get file from the latest 6.1.x distribution of jetty. The plugin seems to support only jetty 6. You can localte it at jetty-6.1.26\etc\webdefault.xml. Obviously, you have to place it at the path specified at the previous step.
Change the default servlet init parameter useFileMappedBuffer to false
I will research the option of using embeded jetty insted of the plugin.
I found a plugin that seem to be a better alternative:
https://github.com/akhikhl/gretty
Positives
Does not lock your files and support hot deployment (even something Gretty call "fast reload")
Gretty 1.2.0 uses Jetty 9.2.9.v20150224. Jetty plugin provided by Gradle 2.2.1 uses Jetty 6.1.25.
same task is used jettyRun (or more simply run).
"Press any key to stop the server". Jetty plugin required CTRL+C then Y.
From what I can tell, the documentation seem to be awesome (Gradle's not so much)
Negatives
A bit more bloated code to setup the buildscript's classpath dependency or apply plugin directly from URL (see doc)
Gretty crash unless you explicitly apply plugin: 'war' (Jetty plugin extends the War plugin)
Kiril answered his own question, many thanks. You should follow Kiril's instructions and this will help you find the appropriate webdefault.xml.
To find out what version of Jetty is started by Gradle, execute
gradle jettyRun -i
And you'll see something like this:
...
Tmp directory = determined at runtime
Web defaults = org/mortbay/jetty/webapp/webdefault.xml
Web overrides = none
Webapp directory = C:\dev\my-project\src\main\webapp
Starting jetty 6.1.25 ...
jetty-6.1.25
...
It took me a while to find a copy of Jetty 6.1.25 as it is no longer listed on the Jetty download page (not even in the archive section!).
You can then grab the appropriate copy of webdefault.xml from here, adjusting the version number as appropriate for your needs:
http://grepcode.com/file/repo1.maven.org/maven2/org.mortbay.jetty/jetty/6.1.25/org/mortbay/jetty/webapp/webdefault.xml

How to get last build label in text file

I have one project which is under Cruise control.
I want to write one console application which will write the last build label of that project in one text file.
CruiseControl passes CCNetLabel argument to script that it invokes. You can just print this out to a file from the script without writing a console application.
If you need to retrieve project version from outside of the CruiseControl, then you can either access this file (i.e.: by exposing it via IIS) or poll and parse XML report of CruiseControl dashboard (which is located at http://BuildServer/XmlServerReport.aspx)
Depends on what flavour of cruisecontrol you use ? For default, java version, i have something like this
<schedule showProgress="true">
<composite showProgress="true">
<exec timeout="2400" command="${homedir}/bin/updatebuildid" args="${sbhomedir}/projects/${project.name} ${label}"/>
..... etc ..
And updatebuild script is basicly a shellscript for invoking sed to add a postfix to a version number in the packaging files. for you it could be just simple "echo $1 > $yourfile"

How to programmatically list all properties defined while executing MSBuild?

I'm looking for a way to access all the Build properties defined while executing MSBuild. I have a configuration file. I want to modify the Properties in the configuration file and copy it to a new location. Is there a way to do it?
If you run the build with /verbosity:detailed or /verbosity:diagnostic you will get very detailed output of all the properties that was used during your build process. However I suspect you want to change a config type file after/before you copy the builded files to another location? In that case there is several mechanismes to do that, what we have found to work pretty good, is the MSBuildCommunity tasks that can be found here on code plex
If you would like to see some samples of this I would be glad to post them