AEM 6.1 and 6.5 switching on local machine - java-8

~We have some projects still running in AEM 6.1 SP2 (the move to newest version of AEM is in progress) and new projects in AEM 6.5.
AEM 6.1 runs in java 8 and AEM 6.5 runs in java 11.
For us developers this switching between jdk versions is difficult in our local environment, quite often we get our AEM instances corrupted or maven project imports are no longer working properly in IDE.
Anyone else had this situation? What are the best practices for such a situation?

My recommendation would be to set up vagrant box instances to your specs (AEM version + Java) and use automated deployments. This way, you can bring up a preconfigured instances in minutes by executing a single vagrant up command, run your automated deployment, and test your projects. If your instance gets corrupted, run a vagrant destroy command, bring up a new instance again with 0 configurations needed for the next deployment. You willincrease your productivity manifolds with this approach.
I have been using this approach for years and it has saved hours of devops work during critical project timelines

If you are using MAC [OSX], you can try Jenv. It can help you to have a unique Java Environment to a specific directory. We did find it very useful.
https://github.com/jenv/jenv
Thanks!

If you are running your AEM instances via shell scripts E.g. ./crx-quickstart/bin/start you can always specify the JAVA_HOME variable to be used in this particular file.
E.g.
export JAVA_HOME="path to your JVM"
export PATH=$JAVA_HOME/bin:$PATH

Related

Is there a way to build the same JavaFX app to a .exe with different build types?

I need to build a javafx aplication to a .exe file, to be used in 3 differents enviroments.
Now, before I build the application to each different enviroment I am changing every variable manualy, like urls, versions and tokens. I know that is a matter of time until I upload the wrong version to the wrong enviroment, so I really need a more automatic process to manage each version.
I read something about maven build profiles but i do not find a way to integrate this in the building of the exe file
This javaFx app is using maven and java10
To build the java code to an exe, I'm using Intellij
Thank you in advance
The big problem is that java 10 is end of lifetime (EOL), so you should already work with java 11, this however is a little more complicated since JavaFx/OpenJfx is now separated. (see https://openjfx.io/)
Anyway to solve your complex needs you should think about a CI platform like as example gitlab CI.
This platforms (with the help of Docker Images) give you the tools you need to properly build and configure complex javaFX build targets and configurations.
But you have to build the .exe file on your own with tools like exe4j if you choose this path.
Side Tips:
In my experience is a lot more easy to build java 11 applications
with gradle instend of just maven since you gain a lot more
flexiblity to solve complex problems
If you stay on java 10 it would be much easier since Java11 + Openjfx
11 required OS dependend builds. (but as I sayed it is EOL)

Spring Tool can't create the java virtual machine

I'm having problems executing Spring Tool, I get the error: Could not create the java virtual machine, and this in another window:
The error message isn't really explaining in detail what the problem is, but I would recommend to things here:
update to a recent JDK 1.8.0 (I think it is at 1.8.0_181 at the moment) and use that.
you can also specify the JVM to run STS in the STS.ini file in the same way than you could do that for plain Eclipse in the eclipse.ini file (described in more detail here: https://wiki.eclipse.org/Eclipse.ini).
It also looks like you are running a 64bit operating system, so in case you have a 64bit JDK installed, you should make sure to download and use the 64bit version of STS. From the error dialog it looks like you are trying to use the 32bit version of STS. You can do that, if you want to, but you would need to make sure that it picks up a 32bit JDK then. But I would strongly recommend to use a 64bit JDK together with the 64bit version of STS.
You better use JDK 1.8 etc. 1.6 is so old for starting new STS

Is it mandatory to install tomcat 7 to install klaros test management community edition even though there is tomcat installed and running

We are trying to install the Klaros-Testmanagement test case management tool (Community Edition). While installing, the Apache Tomcat application container will be installed by the package automatically.
My doubt is even though there is tomcat running, why tomcat server needs to be installed again.
Is there any work around for this?
Klaros-Testmanagement is supported and tested with the supplied Tomcat version only, which also contains some configuration changes from a vanilla Tomcat distribution.
The rationale behind this is to update the distribution on a regular basis and ensure that JVM memory settings and other parameters are configured properly.
If you are feeling adventurous you can try using another version of Tomcat or a completely other application server.
For this you may download the .war only distribution and install it in your container.
Make sure you are picking up configuration changes in the conf and bin folders by diffing them to a vanilla tomcat distribution.
You definitely have to:
Raise memory limitations, esp. MaxPermSize when running under Java 7: -XX:MaxPermSize=192m -Xms256m -Xmx768m or more if needed/available.
Disable session persistence: Uncomment <Manager pathname=""/> in conf/context.xml
Beware that other configuration changes may arise in future releases without further notice, so you are pretty much on your own if things stop working.

IntelliJ, Maven, JRebel (?), Tomcat and Continuous Integration. How To?

I am new in Java and Continuous Integration. I want to setup a development environment using IntelliJ, Maven, GIT and JRebel (this was strongly recommended by a friend of mine). Tomcat Server is on AWS, not on my local Mac OS X machine. Is it possible to use GIT / JRebel and 'update' the remote project on the fly (after saving the files?). Which modules should I install on my Mac and which on Tomcat? Do I need Jenkins as well?
With JRebel Remoting, it is possible to push the changes to the remote applications, without having to configure any extra ports even. This is applicable if you would like to code something in the IDE, and then just push the changes to the remote application. But if you'd like to run the full test suite, then it is better to do via CI and then you will have quite different process - you will have to wait a bit longer until your changes become visible in the running app.

In continuous integration what is the best way to deal with external application dependencies

In using our TeamCity Continuous Integration server we have uncovered some issues that we are unsure as to the best way to handle. Namely how to reference external applications that our application requires on the CI server.
This was initially uncovered with a dependency on Crystal Reports, so we went and installed Crystal Reports on the Server fixing the immediate problem. However as we move more applications over to the CI server we are finding more dependencies.
What is the best strategy here? Is it to continue installing the required applications on the Server?
Thanks
Where possible make the external dependencies part of your build system.
For instance check the installer in to your version control system and have a step that checks it out and runs it in silent mode (many installers support a mode with no user action sometimes using the commandline /s).
This way if you need to set up another build machine for a branch or just for new hardware everything is repeatable.
If your builds require the actual application to complete the build, then you should probably continue to install the application on your build server.
If you just need references to dlls or assemblies from the application, then what we've done at my company is to create installable 'SDKs' of the references required for a particular applicatoin and install them on our development and build machines in well-known library directories that our solutions reference.
On the build machine, our pre-build steps install the correct version of the dependencies and then clean them up when we are finished.
Recently, we've moved to using virtual machines for our build machines that our build process activates. These VMs get the SDKs installed on them as a pre-build, and then are restored to their snap-shot state after the build. We had some dependencies that were almost impossible to uninstall, so this made for a clean starting point each time.
If you use Maven to build, you can define your dependencies in the pom.xml file. They will then be automatically downloaded if necessary.
I am not sure if I followed correctly...
I am assuming your application is dependent on this external app, while building? In that case it should be on the machine doing CI...

Resources