Oct 28, 2015

How to list the profiles of a maven project?

A maven project allows the cascading of projects by using dependencies and modules.


If the profiles are defined somewhere in the chain you can use maven itself to get the list:

$ mvn help:all-profiles
...
[INFO] --- maven-help-plugin:2.2:all-profiles (default-cli) @ aggregation ---
[INFO] Listing Profiles for Project: c.h.b:war:1.0.0-SNAPSHOT
  Profile Id: nexus (Active: true , Source: settings.xml)
  Profile Id: minify (Active: false , Source: pom)
  Profile Id: debug (Active: false , Source: pom)
Listing Profiles for Project: c.h:aggregation:pom:1.0.0-SNAPSHOT
  Profile Id: nexus (Active: true , Source: settings.xml)



Oct 22, 2015

narrowing down methodcompletion in NetBeans when you have CamleCase method names.

Netbeans as a Java IDE has the default completion mode to show all matching methods starting with
the already typed letters.


If you've a lot of methods, you can narrow down the selection by using the uppercase letters of the
CamleCase notation of the method.



Oct 21, 2015

How to add a hostname - ip-address to /etc/hosts inside a docker container

Docker is a container virtualization. This lets you create a image which can be started as a
LXC-Container.

To let the container communicate, e.g. a appserver like wildfly/tomcat with a database, you can
use the option '--link' to give a local name in the appserver container and the name of the container,
which provides the database.

The locale name of the database container is inserted into the local /etc/hosts and is accessible by
name in the data-source definition of an appserver.

Now I have to access an external WebService with https. The certificate is inserted into a java
keystore and the keystore is configured for the JVM-process. ( appserver )

When using the IP-addresse, there is an exception, that the domainname does not match.
Using the domainname of the external server, then it must be resolveable.

In my case this system is not maintained in a DNS-server and therefore I can't use the
--dns and --dns-search of the docker run command.

The first attempt, to add the hostname/IP during building of the image fails, because docker
constructs the /etc/hosts during startup of the container.

After a little searching in the options of docker run, I found the option --add-host=<host:ip>

Supplying this option during the startup of the container with
docker run --add-host=a.b.com:1.1.1.1 ......
add's this host to the containers /etc/hosts and can be used in the configuration inside the container.