Working with Windows Registry in Java 3
jRegistryKey library actually is under LGPL. So it is suitable to be used in commercial projects too! Very simple library, that just works!
Maven Release Plugin — Difference Between “preparationGoals” and “goals” in configuration
Maven Release Plugin lets you release your project easily. However, often during release you want to perform some additional goals. For example, copy the artifact to another server.
There are several ways to do that. Among those is possibility to define goals during Maven release by adding goals or preparationGoals in configuration.
What is the difference between those? When you specify goals, you take over the deployment phase. I mean if you want to run some maven task1 task2 and then still continue deploying your released artifact to the repository, you need to specify the following:
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.0</version>
<configuration>
<goals>task1 task2 deploy</goals>
</configuration>
</plugin>
But if you want to do some additional task, it is better to use preparationGoals. Released artifact anyway will be deployed to the repository, so you don't need to specify deploy explicitly.
Moreover, preprationGoals are activated just before the commit.
Google Will Not Participate in JavaOne
http://googlecode.blogspot.com/2010/08/update-on-javaone.html
By Joshua Bloch
[PACKT] Java EE 6 with GlassFish 3 Application Server
Java EE 6 with GlassFish 3 Application Server is another nice book from PACKT publishing.
It covers GlassFish administration. Then it talks about Java web technologies -- servlets, JSP, JSP STL, JSF. Also discusses database connections, Java Messaging Service, security of applications (you can find more about it in GlassFish Security book). The books also talks about EJBs and new possibilities in Java EE 6 -- contexts and dependency injection. In the last part it discusses JAX-WS and JAX-RS web services. And everything is accompanied with information how to do that with GlassFish application server.
I would very much recommend it to novice Java EE developers or just to developers, who want to have a glance on Java EE web technologies, JMS, Java EE 6 dependency injection, web services and how all that is configured in GlassFish application server. I would say, it is a crash course into Java EE.
The book is not covering each section is deep detail. But gives a broad view on different Java EE possibilities.
The book is full of working examples! What I very much like about it, is that it not only talks about the latest Java EE 6 technologies. But also briefly covers how application can be configured in order to work with older standards.
Working with Windows Registry in Java 2
Ok, so the way to read registry data, which I described in previous post may be not a good idea. It is safer to rely on Windows Reg command. I wrote a simple utility to query registry using that utility.
isExistsfinds whereas registry path existsgetgets the value for specific key on certain registry path
Copy Files with SCP Using Maven
You can use Maven AntRun Plugin and Ant SCP task in order to transfer files with SCP:
Building Obfuscated Signed Java Web Start Applications with Maven
I have Java Web Start application with several libraries, some of which I want to obfuscate before the release. Unfortunately, I cannot use Webstart Maven Plugin since it works correctly only when all the dependencies, which will be assembled, are already present in the repository. In my case, I want to obfuscate libraries on-the-fly, sign them, put into zip file and deploy to my repository.
Instead, I attach the following chain of plugins to maven build lifecycle:
- Download keystore (refer to my older post
- Download all dependencies (except ones, which I will obfuscate) with Maven Dependency Plugin
- Run ProGuard on needed jars with Maven ProGuard Plugin
- Sign all the jars with Maven Jarsigner Plugin
- Filter JNLP file with Maven Resources Plugin
- Assemble application with Maven Assembly Plugin
Working with Windows Registry in Java
There are commercial and free libraries which enable a possibility to work with Windows registry from Java. For example, there is nice, simple, free, but old jRegistryKey library. The problem is that it is gpl and works with additional dll file. It is under LGPL.
However, we can read and write to Windows Registry without additional libraries and any sort of JNI. First, check out this:
http://dmi.ensica.fr/doc/Java/j2sdk-1_4_2-doc/docs/j2h/java/util/prefs/WindowsPreferences.java.html
And here are some examples how guys work with that:
http://www.davidc.net/programming/java/reading-windows-registry-java-without-jni
http://www.jroller.com/lenkite/entry/use_pure_java_to_access
A bit hacky and works only with REG_SZ. But often that is enough!
Obfuscating Several Jars in One Single Maven Build with ProGuard
ProGuard is nice and free tool for obfuscating your code. Actually, it can do a lot more: shrink, optimize and verify your application. But here we will stick solely on obfuscating several jars in one build with ProGuard and Maven.
There are some documentation on ProGuard Maven Plugin website, something on Stack Overflow and ofcourse in official documentation.
Say, you have a complex Java Web Start application consisting of several modules. And you want to obfuscate each module before release. Of course, you do not want to obfuscate for internal usage, but want to do it only before release. What you can do is to use