Oct 11 23

With a newly set up Maven project I tried deploying the site using mvn site:deploy. The command kept failing with the following error

Embedded error: Error performing commands for file transfer
Exit code: 0 - bash: unzip: command not found

for the longest time. I tried all kinds of funny things although I was 100% certain that I do have unzip in path. I was a bit embarresed when I finally realized that this error message was the result of the command executed over SSH on the remote host (Debian Linux) – the one the site was deployed to.

After that it was a piece of cake. Just had to install unzip on Linux using APT: apt-get install unzip

Aug 11 06

Creating a DDL in the Maven build with the hibernate3-maven-plugin fails if you explicitly configure an array of javax.persistence.CascadeType values in your JPA annotations. The stacktrace is similar to

javax.persistence.PersistenceException: [PersistenceUnit: spontacts] Unable to configure EntityManagerFactory
	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:265)
	at org.codehaus.mojo.hibernate3.configuration.JPAComponentConfiguration.createConfiguration(JPAComponentConfiguration.java:28)
...
Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.EnumConstantNotPresentExceptionProxy
	at sun.reflect.annotation.AnnotationParser.parseEnumArray(AnnotationParser.java:673)
	at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:462)

Once I realized what the actual cause is, the fix was simple. Turns out that the CascadeType is not in the classpath when Maven runs the hbm2ddl goal. Hence you need to add a dependency to JPA to the hibernate3-maven-plugin:

<plugin>
	<groupId>org.codehaus.mojo</groupId>
	<artifactId>hibernate3-maven-plugin</artifactId>
	<dependencies>
		<dependency>
			<groupId>org.hibernate.javax.persistence</groupId>
			<artifactId>hibernate-jpa-2.0-api</artifactId>
			<version>1.0.0.Final</version>
		</dependency>
	</dependencies>
	<executions>
		...
	</executions>
	<configuration>
		...
	</configuration>
</plugin>

A solution to this exception in a different context was posted here: http://javahowto.blogspot.com/2008/10/solve-javalangarraystoreexception.html

Feb 11 04
  • Checkout the mojo source code
  • Run mvn install on the mojo
  • Change to the project that uses the mojo for its build
  • Run mvnDebug <whatever options> -> Maven waits for a debugger to attach before executing
  • Setup a new remote debugging configuration in Eclipse, using the plugin project for source and connecting to localhost:8000 (Maven tells you which port when you run mvnDebug)