Friday, May 25, 2012

maven-antrun-plugin is maven plugin that let you run ant target in pom


Maven AntRun Plugin

This plugin provides the ability to run Ant tasks from within Maven. You can even embed your Ant scripts in the POM!
It is not the intention of this plugin to provide a means of polluting the POM, so it's encouraged to move all your Ant tasks to a build.xml file and just call it from the POM using Ant's  task.
One of the main purposes of this plugin is to facilitate the migration from Ant based projects to Maven. Some projects may not currently be able to migrate because they depend on custom build functionality that Maven doesn't provide by default.

mvn plugin get outofmemory while instructing the compiled classes


while run maven plugin cobertura's target to instruct the class,get outofmemory error
solution
add following property in pom will solve the problem


...

...



    256M



AXIOM


The Apache Axiom™ library provides an XML Infoset compliant object model implementation which supports on-demand building of the object tree. It supports a novel "pull-through" model which allows one to turn off the tree building and directly access the underlying pull event stream using the StAX API. It also has built in support for XML Optimized Packaging (XOP) and MTOM, the combination of which allows XML to carry binary data efficiently and in a transparent manner. The combination of these is an easy to use API with a very high performant architecture!
Developed as part of Apache Axis2, Apache Axiom is the core of Apache Axis2. However, it is a pure standalone XML Infoset model with novel features and can be used independently of Apache Axis2.

Thursday, May 24, 2012

maven dependency scope


Dependency scope is used to limit the transitivity of a dependency, and also to affect the classpath used for various build tasks.
There are 6 scopes available:
  • compile
    This is the default scope, used if none is specified. Compile dependencies are available in all classpaths of a project. Furthermore, those dependencies are propagated to dependent projects.
  • provided
    This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java EE APIs to scope provided because the web container provides those classes. This scope is only available on the compilation and test classpath, and is not transitive.
  • runtime
    This scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath.
  • test
    This scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases.
  • system
    This scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository.
  • import (only available in Maven 2.0.9 or later)
    This scope is only used on a dependency of type pom in the  section. It indicates that the specified POM should be replaced with the dependencies in that POM's  section. Since they are replaced, dependencies with a scope of import do not actually participate in limiting the transitivity of a dependency.

Perl language variable types

in perl, there are three data types
1)scalar
  my $animal ="camel";
  my $amswer = 42;
2) arrays
  my @animals =("camel","llama","owl");
  my @numbers = (23,42,69);
  my @mixed = ("camel",42,123.56);
3)hashes
   my %fruit_color = ("apple","red","banana","yellow");
   my %fruit_color =(apple=>"red",banana =>"yellow",);

Thursday, May 17, 2012

Maven project build problems

Having one maven project that build jar file need few minutes,each time when we need run the job from a ant script,we made change,then using maven build jar file,then using ant script pass job name as a parameter,then run the job.
this process is not efficiency because any small change need a rebuild jar file.
solution:
change ant script running target's classpath to include project/target/classes fold as a pathelement's path attribute,set project in eclipse build automatically,then make changes,eclipse will automatically build project(compile source code,copy resource into target/classes folder),we don't need to run maven job to compile and package jar file,run ant script directly, that will save amount of time.

looks like when we change java code,auto build is fast,but when we change a resource,builds are little slow.