asadmin-maven-plugin-0.2 released
I released the second version of asadmin-maven-plugin today.
It added the following features :
- Issue#1: support for maven projects with “ejb” packaging
- support for (un)deploying to remote glassfish instance (thanks to Larry Sanderson that provided the patch)
The following issues were fixed :
- Issue#2: asadmin is not found when only glassfishHome is specified and glassfishHome/bin not in PATH (thanks to streifi that provided a patch)
- Issue#3: asadmin:start-domain hangs on windows (thanks again to streifi)
Go to the project’s page for more information.
Maven plugins for Glassfish ecosystem
This post is only a snapshot of what is available at the time of writing to use Glassfish from maven., seen from the perspective of a simple maven plugin developer (simple plugin or simple developer ?).
Before beginning asadmin-maven-plugin, I searched and tried several ways to use Glassfish from maven. Main use case is simply deployment and undeployment of applications.
There are two ways to do this “programmatically” :
A repository for asadmin-maven-plugin
To ease the use of asadmin-maven-plugin I have set up a public repository that you can add to your maven settings / poms / proxies for maven to be able to download the plugin automagically.
The repositories are :
- Releases Repository : http://asadmin-maven-plugin.googlecode.com/svn/trunk/repository/releases - contains nothing ATM
- Snapshots Repository : http://asadmin-maven-plugin.googlecode.com/svn/trunk/repository/snapshots - contains the 0.1-SNAPSHOT
Here is the xml snippet you could add to your pom.xml file :
<pluginRepositories>
<pluginRepository>
<id>asadmin-maven-plugin-releases-repository</id>
<name>asadmin-maven-plugin-releases-repository</name>
<url>http://asadmin-maven-plugin.googlecode.com/svn/trunk/repository/releases</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</pluginRepository>
<pluginRepository>
<id>asadmin-maven-plugin-snapshots-repository</id>
<name>asadmin-maven-plugin-snapshots-repository</name>
<url>http://asadmin-maven-plugin.googlecode.com/svn/trunk/repository/snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
Plus, if you browse the source tree you’ll find two exemple projects, a WAR and an EAR, that use this plugin.
A simple maven plugin for Glassfish: asadmin-maven-plugin
To seamlessly use Glassfish from maven projects, JSR-88 seems to be answer. The cargo maven plugin has JSR-88 support planned but this will take time.
I published some days ago a maven plugin that simply wraps the asadmin command and aims to provide maven integration for starting, stopping glassfish and deploying and undeploying applications and modules.
Go to the Google Code page of asadmin-maven-plugin to download a preview version named asadmin-maven-plugin-0.1-SNAPSHOT : http://code.google.com/p/asadmin-maven-plugin/
The api is designed for easy extensibility so feel free to submit contributions !
(more…)
A simple^W dumb Map wrapper to use with JAXB
I sometimes need to use java.util.Map objects in WebServices. As I’m building all my WebServices with the JAX-WS RI (using the Metro bundle). The block responsible for XML (un)marshalling of POJO, named JAXB, does not allows to directly use Maps as a soap operation parameter. For this purpose I’ve written the following simple class that allows me to wrap Maps in a POJO that JAXB is able to (un)marshall :
public class JAXBMapWrapper<KT, VT> {
private Map<KT, VT> wrappedMap;
public JAXBMapWrapper() {
wrappedMap = new HashMap<KT, VT>();
}
public Map<KT, VT> getWrappedMap() {
return wrappedMap;
}
public void setWrappedMap(final Map<KT, VT> givenMap) {
wrappedMap = givenMap;
}
}
ATTENTION : I posted this some days ago and removed the post after understanding that this is simpler on the service side but that the client side gets cumbersome generated classes.. but google cache indexed the post in less than half a day.
Just don’t use this !
If you need to transmit Maps over JAX-WS webservices, do it the XmlAdapter way as advertised in the official Unofficial JAXB Guide instead.
Could it be dared to say that java is overdesigned ?
Java 7 is coming. And it’s an awesome project ! Now that java is distributed under the GPL, developers can believe that the JSR way of doing things will be more and more pragmatic.
The title of this post is a little bit coarse but this is the feeling java gives to developpers who “learn and use java to create and run programs that make devices and internet useful for people“.
I just read some articles about jdk7 changes that I want to share :
About the new framework for fork-join style parallel decomposition and the ParallelArray class in java.util.concurrent :
About the first attempt to give packages and visibility modifiers a lift :
The first ones are really exciting ! The one about the superpackages scares me a little. I know it’s the first “public” communication about it but I sincerely hope that the final solution will be presented with successfull examples of complex implementations, ie. will be pragmatic.
JAXB Custom Binding for Joda-Time
I’m extensively using Joda-Time for handling time in my Java development, client or server side. Joda-Time is the codebase of the coming RI implementation of JSR-310 that will hopefully ship in Java 7.
I often need to work with dates in web services implementations, here is the JAXB custom binding lines I use to un/marshall JodaTime types to standard xs:date and xs:dateTime XML Schema types.
Note : I’m using the RI implementation of JAXB spec bundled in Metro.
(more…)
Classpath tools : jcfind and JWhich
Deep understanding of Java classpath is something that is too often neglected. I won’t write an article about classpath, internet is full of readings about it :
- How Classes are Found at java.sun.com
- Classpath (Java) page from Wikipedia
- Classpath entry in the Java Glossary
- Java Tip 105: Mastering the classpath with JWhich
Here come JWhich and jcfind. Both are classpath reflection tools.
JWhich provides a command line interface and a Java api where jcfind only has command line interface and is written in python.
I prefer to use jcfind from the command line because it’s really faster than Which4j and the command line is more practical. In Java software, I use the JWhich API that is really easy to use. The big drawback of using Which4j from command line is that you must provide a full class name, using it’s API you can search for a class simple name.
Building an EJB3 app using GlassFish v2, Maven2 and NetBeans 6
In an article explicitly titled Building an EJB 3.0 application using GlassFish v2, Apache Maven 2 and NetBeans IDE 6.0, Jacek Laskowski explain in detail how Netbeans 6 can be used by maven users willing to use GlassFish as an EJB3 container.
I’m currently doing these type of things with Netbeans 6 but I didn’t know it was feasible with so few command line maven invocations.
Quick and dirty howto : Use Hibernate in Glassfish V2
For my first post here I’ll write a quick and dirty howto for using Hibernate inside the Glassfish V2 container.
- Download Hibernate projects
- Put’em in the domain’s lib dir
- Change your persistence.xml file
- Enjoy
Details are following :
(more…)