install4j how to specify install dir on Windows Gradle - gradle

I have trouble using install4j on Windows for the project tripleA.
See source at: https://github.com/gaborbernat/triplea/blob/installer/build.gradle
I'm using the Gradle Plugin however I'm unable to specify the install 4j home directory.
If I try using absolute path that is 'C:/Program Files/install4j6' i get a normalization error as it gets translated to:
"C:/data/tripleA/'C:/Program Files/install4j6'"
what am I missing here? why is file('C:/Program Files/install4j6') referring to "C:/data/tripleA/'C:/Program Files/install4j6'"?
Now if I use a relative path it says the folder does not exists.
Thanks,

Due to your build.gradle, the path is retrieved from properties file. It seems, that this path in your properties is placed within single quotes, as 'C:/Program Files/install4j6', and your gradle script logic get the value with this quotes.
That is the reason, file() doesn't recognize it as absolute path and tries to parse it as relative. Here is some code, which reproduces your exception:
task testFile {
File ff = file('\'d:/test.xml\'')
println ff.absolutePath
}
This will cause an error
Could not normalize path for file 'D:\path\to\your\project\'d:\test.xml''
So, you should try to change the property, to make it a plain string without quotes.

Related

Best way to reference a file path with Gitlab, Gradle and Bash?

I have a bash script in my Gitlab pipeline that execute a gradle command. Within that gradle command, I reference a file. I keep getting issues with the file not being found and I assume it's because of how the relative pathing is working.
Snippet of Gradle Command
path {
from = file("folder")
into = '/targetFolder/'
}
Shell Script
gradle :${APP_PATH}:jib
I've tired projectDir and I've tried relative path like ../../etc, but no luck. What's the best way to reference the file directly? It's underneath rootproject/config/folder
it appears that you are trying to call sub-project target when you call below in the Shell script gradle :${APP_PATH}:jib
as you mentioned you need config folder relative at the root-project
Use paths from rootDir of rootProject.
files(project.rootProject.rootDir + '/config/folder')

Unable to get Sonar-Qube to analyze project

I have seen the other 2 appends and added sonar.languages=COBOL to my sonar-project.properties file to no avail.
I think it's basically more a case of not understanding the documentation (or the latter never having been "idiot tested"").
My problem is as follows. My properties file contains the following entries:-
# sonar.sources=../../mfuser/seb/source/
sonar.sources=C:/mfuser/SEB/Source
sonar.cobol.file.suffixes=cbl,cpy
sonar.cobol.copy.suffixes=cpy
#
sonar.languages=COBOL
When I run the sonar-scanner bat file, I'm seeing output like this:-
WARN File C:\mfuser\seb\source\vvira20.cbl is ignored. It is not located in module basedir c:\sonar-scanner\bin
To me this gives the impression that I can point to the directory containing my COBOL code, but at the same time the actual code HAS to be in c:\sonar-scanner\bin. Surely, that can't be the case? If it is, what is the point with the sonar.sources entry in the properties file?
In addition, onece I get this working, is there some way of specifying a parm/wild card so as to analyze SPECIFIC files. I tried sonar.sources=C:/mfuser/SEB/Source/vno* but that didn't seem to make any difference.
Thanks
You ran sonar-scanner from its own directory instead of running from the project directory. As the documentation says:
Run the following command from the project base directory
sonar-scanner
This same documentation recommends to create the sonar-project.properties file at the root of the project directory and to set the "sonar.sources" property to a path which is relative to the sonar-project.properties file.
Alternatively, you may want to use the "sonar.projectBaseDir" property. See the documentation for analysis parameters.

How to represent directory of IzPack installer?

I'm using Maven and IzPack. I'm looking for a way to put a file into the directory of the installer file. In the install.xml I've got a file tag set with a targetdir of "." but that will only work if the installer is executed from that directory. If executed from a different directory, the file is put in the current working directory of the user instead.
Having checked IzPack documentation, there's a built-in variable for $INSTALL_PATH, but I need the path of the installer. There's no way to predict where this installer will be when executed so specifying a pre-set directory won't work. Trying to specify the local directory via Maven just gives the path to the POM.
Is there an undocumented variable that would do the job or something else I've overlooked?

Reference a path outside the project directory

learning Gradle, and I am running into an issue. I'd like to add the JAR files from the TomcatEE directory to the compilation classpath, and the tomcatEE directory lives outside the project hierarchy on the file system. For example, the tomcatEE directory is "C:/servers/tomcatee/". I want to define a property "tomcarDir" and then add tomcatDir + '/lib/' to the build path, but Gradle insists on appending the project directory to the start. How do I specify an absolute path like this?
I found my error. In my gradle.properties file, I had the path to the tomcat directory enclosed in single quotes. By removing them, Gradle started treating it as an absoolute file path.

How to make the yuicompressor jar file a singleton, or globally accessible?

I'd like to put the yuicompressor jar file in a single folder so that I can call
java -jar yuicompressor-2.4.2.jar ...
from anywhere on my system, with cygwin. For bash files I use I simply put them in a common folder, and added the folder's path to my windows user's PATH environment variable and the bash commands were found in cygwin.
when I echo $PATH I see the folder I put the yuicompressor jar into listed in the $PATH..
But when I try java -jar yuicompressor-x.y.z.jar myfile.js -o myfile-min.js (for example) I get the following error message:
Unable to access jarfile yuicompressor-2.4.2.jar
Even when I try providing an absolute path to the jarfile I get the same error message..
How can I do this?
The PATH environment variable is a list of directories the shell will search through in an attempt to run a command.
java.exe will not search the directories on the PATH environment variable to try and locate the archive you are attempting to run. So running java -jar yuicompressor-2.4.2.jar from any directory other than the one containing the archive would be expected to fail.
What is the full command you are attempting when providing an absolute path?

Resources