Posts Tagged ‘Maven’

Minify Maven Plugin with support for JavaScript Source Maps

July 31st, 2014

The new version (1.7.3) of Minify Maven Plugin has just been released.

The list of enhancements include:

  • Support for JavaScript Source Maps
  • Better docs
  • Update to the last version of Google Closure Compiler
  • Add support for Google Closure Compiler angular_pass option to support AngularJS @ngInject annotations

Get it while it’s still hot!

Minify Maven Plugin adds support for Google Closure Compiler

February 18th, 2013

I’ve recently implemented some new improvements to Minify Maven Plugin.
Version 1.6 added support for Google Closure Compiler and version 1.7 offers several performance improvements and more detailed logs (e.g. compression benefits from minification).

A complete list of changes can be found in the changelog file.
For next releases I’m planning to add Source Maps support and improve the documentation.

Maven 2 Cobertura Plugin – Updated

April 14th, 2010

My previous Maven 2 Cobertura Plugin article gives a workaround for the very buggy version 2.1 of the Cobertura Maven Plugin.

This bug is fixed on versions 2.2 or higher, and consequently, that workaround does not work anymore.
For those reading my previous article and having difficulties configuring the plugin, this is my actual configuration.

» Read more: Maven 2 Cobertura Plugin – Updated

Maven Minify Plugin using YUI Compressor

June 11th, 2009

Following the previous article Combine and minimize JavaScript and CSS files for faster loading, I implemented a similar solution as a Maven plugin.

This plugin combines and minimizes JavaScript and CSS files using YUI Compressor for faster page loading.

More details can be found on the Minify Maven Plugin page.

Maven 2 Cobertura Plugin

June 24th, 2007

The Maven 2 Cobertura Plugin web site lacks information to successfully generate Cobertura reports. Worse, some of the usage examples are incorrect and don’t work.

The most common problem when generating Cobertura reports is when the generated report shows 100% test coverage while in reality many of the classes don’t even have tests.

The following example shows how to configure the reports so that it would reflect real test coverage and then check if the specified packages achieved the wanted test coverage:

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <version>2.1</version>
            <configuration>
                <check>
                    <haltOnFailure>false</haltOnFailure>
                    <regexes>
                        <regex>
                            <pattern>com.samaxes.business.*</pattern>
                            <branchRate>90</branchRate>
                            <lineRate>90</lineRate>
                        </regex>
                        <regex>
                            <pattern>com.samaxes.persistence.*</pattern>
                            <branchRate>90</branchRate>
                            <lineRate>90</lineRate>
                        </regex>
                    </regexes>
                </check>
                <instrumentation>
                    <includes>
                        <include>com/samaxes/**/*.class</include>
                    </includes>
                </instrumentation>
            </configuration>
            <executions>
                <execution>
                    <id>clean</id>
                    <phase>pre-site</phase>
                    <goals>
                        <goal>clean</goal>
                    </goals>
                </execution>
                <execution>
                    <id>instrument</id>
                    <phase>site</phase>
                    <goals>
                        <goal>instrument</goal>
                        <goal>cobertura</goal>
                        <goal>check</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
<reporting>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
        </plugin>
    </plugins>
</reporting>

Using Maven 2, XDoclet 2, and Hibernate 3

July 3rd, 2006

Problem – You want to use the last Hibernate 3 (Object to Relational Mapping Solution) with a code generation tool that automatically generates your Hibernate descriptor files, and build your project with an advanced build tool like Maven2.

Solution – Use maven2-xdoclet2-plugin.

Maven is a popular open source build tool for enterprise Java projects; it can manage a project’s build, reporting and documentation from a central piece of information (POM file).

XDoclet is an open source code generation engine with the goal of continuous integration. It enables Attribute-Oriented Programming for java. It uses custom JavaDoc-like tags to generate external resource files to support the main Java classes. XDoclet has mainly been used for the auto-generation of EJB descriptors (and related J2EE container technologies).
XDoclet2 is a rewrite of the XDoclet engine. It allows you to use Hibernate 3 features, Java5 language features in your model POJOs, and has substantially better error reporting than XDoclet.
» Read more: Using Maven 2, XDoclet 2, and Hibernate 3