Monday, March 2, 2009

Maven compile sources version 1.5

Add following to pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>

Sunday, March 1, 2009

Maven artifact sources

Download sources of artifacts (from pom.xml) to local repository.

set JAVA_HOME=C:\jdk1.6.0
set MAVEN_HOME=D:\java\apache-maven-2.0.9
%MAVEN_HOME%\bin\mvn dependency:sources

Thursday, February 26, 2009

Hibernate Spring where clause

public List getSongs(Long artistId) {
return getHibernateTemplate().find("from Song as song where song.artist.id = ?", new Object [] {artistId});
}

Wednesday, February 25, 2009

Use regexp in Digester

How to configure Digester to use reg exp pattern like *
<pattern value="*AddRs">
...
<pattern>

URL rulesXml = getClass().getClassLoader().getResource(path);
RuleSet ruleSet = new FromXmlRuleSet(rulesXml);
Digester digester = new Digester();
digester.setRules(new RegexRules(new SimpleRegexMatcher()));
digester.addRuleSet(ruleSet);
return digester;

Maven dependency tree

set JAVA_HOME=C:\jdk1.6.0
set MAVEN_HOME=D:\java\apache-maven-2.0.9
%MAVEN_HOME%\bin\mvn dependency:tree > dep.txt

Followers