How can be set system compiler variable sys.version externally - install4j

I tried setting the sys.version variable from the build script where I am also setting the other user created compiler variable while running the ./install4jc command for building the installer. It is not setting the variable and it's saying giving a warning message: [WARNING] The variable 'sys.version' is a system variable that cannot be overridden.
The requirement is the version number should not be hard coded in the Installer file. Please advise how can I achieve that.

On the command line, specify the version with
-r [version]
Ant task as well as gradle and maven plugins have corresponding parameters.

Related

Can't load cake module - Preprocessor directive expected

I'm trying to run a cake build script that loads a module for long file path but it only returns
error CS1024: Preprocessor directive expected
In the cake file I have added
#module nuget:?package=Cake.LongPath.Module&version=0.5.0
and this is the line where I get the error at (1,2)
In the docs It states that this is the format and that I should run the script with --bootstrap before actually running the script. Running Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" --bootstrap" causes a the error and then I also get it on the line after when running it without the --bootstrap flag.
What I need is to make sure that Cake.LongPath module is installed and loaded in CI. Any thoughts on other solutions would also be helpful
The --bootstrap command was only added in Version 0.24.0 of Cake. You can see the release notes here:
https://github.com/cake-build/cake/releases/tag/v0.24.0
And the issue that it was worked on here:
https://github.com/cake-build/cake/issues/1950
I am fairly sure that this issue will be solved by upgrading to a newer version of Cake. This can be done by changing the version number in the packages.config file, and by clearing out the tools folder. NOTE: Depending on what version of the bootstrapper you are using, the clearing out of the tools folder may be done for you automatically.

How do I read a Linux environment variable into install4j

My application sets CLASSPATH in a shell script named shrc that sets up the environment to run java commands. Is there an easy way to pass the CLASSPATH used in an installed application to install4j so I can use it in an action? The working solution I have uses "Run executable or batch file" to run a script that does this:
. ./shrc
${APPHOME}/jre/bin/java -cp ${CLASSPATH} ...etc...
I do this within an add-on installer, so the shrc already exists, but I need to run some of the existing java code to configure the patches.
It seems to me there must be a better way to do this that would work on Windows also. Any help is appreciated.
To read environment variables, use
System.getenv("CLASSPATH")
If you would like to use it as an install4j installer variable, add a "Set a variable" action with the above line as the script.

Grails 2.3.1 in GGTS(Eclipse): Out of memory error when using run-script

I am executing a groovy script with run-script and running out of memory. I have found instructions for configuring ones GRAILS_OPTS on the command line, however I am not on the command line. How do I make sure that the grails command prompt in GGTS(Eclipse) is configured to provide enough memory for a script?
Just to be clear - this is a problem with run-script from the groovy command prompt inside The GGTS 3.4.0 release (Eclipse).
You can try setting the JAVA_OPTS system variable instead of the specific GRAILS_OPTS variable. It seems to work for me.
e.g
JAVA_OPTS="-Xms1024m -Xmx2024m -XX:MaxPermSize=512m"
For reference from grails docs - http://grails.org/doc/2.3.x/guide/commandLine.html, search for JAVA_OPTS. Depending on what OS you are on the syntax may be different.

Invoking install4j compiler from ant results in PermGen OutOfMemory errors

I've run into a situation where install4j v4.2.8 runs fine and generates installers when using the GUI and when invoking install4jc from the command line, but fails with the following message when invoked via the install4j ant task:
install4j: compilation failed. Reason: java.lang.OutOfMemoryError: PermGen space
Using visualvm, I determined that the ant task is forking a separate JVM, which appears to fail when the PermGen usage hits about 88MB. The install4j ant task docs don't say anything about being able to pass VM args (such as -XX:MaxPermSize=256MB) through to the forked JVM, but I'm wondering if that or something similar would be an option.
You can adjust the VM parameters for the command line compiler in the file [install4j installation directory]/bin/install4j.vmoptions. Just increase the -Xmx value there and add the -XX:MaxPermSize VM parameter.
Prior to install4j 5.0.7, there was a bug related to includes of relative files in .vmoptions files. For these older versions, remove the include to install4j.vmoptions in install4jc.vmoptions and add the VM parameters directly there.

How do I build a project that uses sbt as its build system?

I have downloaded a project which uses sbt as its build system and I want to build it. You'd think it would be as simple as typing "sbt" or something, but no.
I thought I'd add a question for this because it can take literally hours to figure this out on your own. I'm not joking.
tl;dr:
sbt compile
If you want to run it:
sbt run
To see what other targets are available:
sbt tasks
To get some (other) help, but mostly targeted at commands typed from the sbt console (ie, running sbt without parameters):
sbt help
This all assumes sbt version >= 0.10.0. To see what version of sbt is in use, do:
grep sbt.version project/build.properties
If there's no such file, and there's a file with extension ".sbt" on the base directory (not the project directory), then it's >= 0.10.0. Of course, if the grep works, it should tell you the version.
First, you'll want to use sbt-extras, because that automatically downloads and uses the right version of sbt. Trying to use the wrong version of sbt (newer or older than what the project you're trying to build says it requires) won't necessarily work, and may cause strange errors.
Run it:
~/path/to/sbt-extras/sbt
Wait for it to start up and download everything. If you need to use an authenticated proxy, you'll need to edit the script to specify the username and password for the proxy.
Check the version of Scala that sbt thinks it needs to build against (at the end of the output, if everything worked). If this is OK, fine, you don't need to do anything. If it isn't, you can temporarily specify a version explicitly with ++, e.g.:
++2.8.1
(If you want to make this permanent, you can edit the build definition files, but as that involves making a change to files under version control, that might not be what you want to do.)
Now, if you are using an older version of sbt, don't skip the next step! You could get strange errors if you do.
update
Now you can build and test what you've built:
test
If you get an error "Filename too long", this is not an sbt-specific problem, it's a scala problem, which most frequently affects Ubuntu users (technically, for Unbuntu users it's generally related to home directories encrypted with encfs). If you are using Scala >= 2.9, edit the build to use the scalac command-line option that allows you to specify a maximum filename length. Otherwise, if you are on Linux, you can redirect the build to /dev/shm or /tmp, by running these commands in a shell prompt (don't background sbt with CTRL+Z on Unix, because it may appear to stop working properly):
rm -rf target
ln -s /dev/shm target
(you may have to execute these commands in project/build instead or as well.)
Actually, it's probably better, and may even be more secure, to create a subdirectory of /dev/shm or /tmp and use that instead.
The compilation result should appear in target. You might then want to run it, if it's something you can run:
run
If everything looks OK, you can optionally publish the result locally so that the result can then be picked up automatically by other sbt builds:
publish-local
I don't think I could explain it better that the Getting Started Guide could. Please read the first 6 parts of it, which shouldn't too long time, to get it up and running.