Suggested Pages

Friday, March 22, 2013


I want to indicate a new blog that speaks about Liferay. It was created a few days ago but I'm sure in the next period, It will have many posts on the portal container Liferay.
Here it is:

Tuesday, March 19, 2013

Select for Update

A select for update is often use as a semaphore on your database. If you plan a transaction with a select for update, you are avoiding the other transactions to get a read o write lock on the accessed rows; at this way you are implementing a sort of semaphore that is released only when the transaction ends.

Maven Dependencies Plugin

In this post I will show an example of usage of the dependency plugin, that can be used when you want to make a check of your project dependencies. The dependency plugin has two main goals:
  • dependency:resolve
  • dependency:tree


The goal mvn dependency:resolve permits to see all dependencies of an artifact and its related features; for example it shows the scope of your dependency artifacts.
A common situation to use this goal is when you are interested to verify which jars are in WEB-INF/lib of your deployed war. If you run mvn dependency:resolve, you can see if your dependencies artifact are provided or compile and make a quick check on your dependencies. Here you are an example of output of this goal:

a@b:  cd myproject

a@b:  ls
pom.xml  src  target

a@b:  dependency:resolve

[INFO] [dependency:resolve {execution: default-cli}]
[INFO]    The following files have been resolved:
[INFO]    antlr:antlr:jar:2.7.7:compile
[INFO]    aopalliance:aopalliance:jar:1.0:compile
[INFO]    asm:asm:jar:3.3.1:compile
[INFO]    cglib:cglib:jar:2.2.2:compile
[INFO]    ch.qos.logback:logback-classic:jar:1.0.7:compile
[INFO]    ch.qos.logback:logback-core:jar:1.0.7:compile
[INFO]    com.caucho:hessian:jar:4.0.7:compile
[INFO]    com.liferay.portal:portal-client:jar:6.1.20:provided
[INFO]    com.liferay.portal:portal-impl:jar:6.1.20:provided
[INFO]    com.liferay.portal:portal-service:jar:6.1.20:provided
[INFO]    com.liferay.portal:util-bridges:jar:6.1.20:provided
[INFO]    com.liferay.portal:util-java:jar:6.1.20:provided
[INFO]    com.liferay.portal:util-taglib:jar:6.1.20:provided
[INFO]    com.mchange:c3p0:jar:0.9.2-pre5:compile
[INFO]    com.mchange:mchange-commons-java:jar:0.2.3:compile
[INFO]    com.sun.xml.bind:jaxb-impl:jar:2.1.11:compile


The goal dependency:tree permits to see the all tree of dependencies of an artifact. The output of this goal is a tree that shows the origin of your dependencies.
Here you are an example of output of this goal:

a@b:  cd myproject

a@b:  ls
pom.xml  src  target

a@b:  dependency:tree

[INFO] +- myartifact:myproject:myversion:compile
[INFO] |  +- javax.xml:jaxrpc-api:jar:1.1:compile
[INFO] |  +- org.apache.cxf.xjc-utils:cxf-xjc-runtime:jar:2.6.0:compile
[INFO] |  |  \- javax.xml.bind:jaxb-api:jar:2.2:compile
[INFO] |  |     +-
[INFO] |  |     \- javax.activation:activation:jar:1.0.2:compile
[INFO] |  +- org.apache.cxf:cxf-api:jar:2.6.0:compile
[INFO] |  |  +- org.codehaus.woodstox:woodstox-core-asl:jar:4.1.2:runtime
[INFO] |  |  |  \- org.codehaus.woodstox:stax2-api:jar:3.1.1:runtime
[INFO] |  |  +-
[INFO] |  |  +- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.1:compile
[INFO] |  |  \- wsdl4j:wsdl4j:jar:1.6.2:compile
[INFO] |  +- org.apache.cxf:cxf-rt-frontend-jaxws:jar:2.6.0:compile
[INFO] |  |  +- xml-resolver:xml-resolver:jar:1.2:compile
[INFO] |  |  +- asm:asm:jar:3.3.1:compile

Suggested Pages