Showing posts with label maven2. Show all posts
Showing posts with label maven2. Show all posts

Wednesday, July 8, 2009

MOP version 1.6

It's been some time since I performed MOP release.

Quite a few things has changed in MOP:
With new release 1.6 that can be found in Maven Central Repository new configuration option has been introduced.

Let me introduce you to showVersion option :-)
showVersion

Monday, January 12, 2009

Maven Archetype Automation 1

In my need for automation I found another place for improvements in Maven2.

Here is a situation: you have sample project showing how to use something.

And you want to be nice to your users so you would like to offer them this sample project as archetype via archetype-catalog.xml.

Here is a bit longer version of above:


ArchetypeNG seems like possible solution, have to research this one.

Wednesday, December 24, 2008

Grizzly OSGi Archetype

This is take 2 of Grizzly on OSGi platform (take 1).

Previous problems running this configuration has been solved by Grizzly Devs, awesome feedback.

So if you want a Quick Start for Grizzly on OSGi jump to your console and execute following:
mvn archetype:generate -DarchetypeCatalog=http://kungfoo-m2.googlecode.com/svn/trunk/archetype-catalog.xml
This should allow you to choose grizzly-osgi-startup project and provide all necessary project details.
Next thing you do is to cd to newly created project and execute:
mvn clean install pax:provision
Now you should have Felix (default for Pax, you can choose other platform providers) running your bundle that uses Grizzly and is listening on localhost:8282.

Have fun Grizzling in OSGi.

Monday, July 7, 2008

Super Helpful Integration Testing ThingY

Maven plug-in integration testing.



After walking around integration tests for Overview I finally set down and made it happen.

Most helpful integration testing solution I found is called SHITTY http://mojo.codehaus.org/shitty-maven-plugin/.

It is very easy to use.

As sane developer would expect, you'll have to put your integration tests somewhere in src (src/it).

Integration test is:
  • yes you are right, pom.xml,
  • than goals.txt - defining goals to execute,
  • optional setup and validation Groovy scripts.
  • some additional stuff that wasn't needed for me.
You can find sample usage here.

Big thanks to Jason Dillon for creating Super Helpful Integration Testing ThingY.

Tuesday, February 12, 2008

Maven2 Landskape - Developers view

So Maven Dependency Overview Plugin has been created.
Maven has it's ups and downs as any project.

Here is a list of things that made it harder than needed to create a report plugin:
  • Documentation is hard to get.
    Try searching Maven2 Plugin Development. You can find some basic information but soon you'll run into undocumented features.
    Most of a time while viewing documentation I felt like someone wrote it because he/she was forced to do it.
    Most valuable resource for me where:
  • Poor API documentation.
    There is a plugin (maven-docck-plugin) designed to force proper documentation, unfortunately some plugins even one shipped with Maven are not using it.
  • Unstable API.
    take a look at dependencies of maven-reporting-impl. It depends on doxia-core and doxia-site-renderer both are version 1.0-alpha-7, not documented.
Good luck developing Maven plugins, you'll need it, but it's rewarding.

I'll try to write integration test for Maven Dependency Overview Plugin, hope it is going to be as much fun as developing plugin by itself.

I'll keep you posted.

Friday, February 8, 2008

Maven Dependency Overview

Maven Dependency Overview

Since I started working with Maven2 I always wanted to have a plug-in that would graph dependency.


For last few days I've been spending part of my free time on maven-overview-plugin.

And here it is in quite usable state.

You can include report with Dependency Overview, you can use it from command line, you can do some basic configuration.

To prove that it is actually useful I wrote short story of it's use: DependencyCleanUpShortStory.

Feel free to use it it is OS Licence.

Wednesday, November 7, 2007

Maven2 cargo plugin and integration test

So I was facing a problem of creating Maven2 project that would:
  1. Create domain based on JBoss default server configuration,
  2. Copy to this newly created domain configuration file and datasource configuration,
  3. Start container with domain that was result of #2.
I thought that cargo-maven2-plugin will do the job.
Unfortunately it didn't.

My initial approach was:
  1. Attach cargo:configure (undocumented goal :-/) to generate-test-sources phase, using standalone type, so configuration gets generated from scratch based on default,
  2. Attach antrun:run to generate-test-resources phase to copy .properties to conf, and -ds.xml to deploy,
  3. Attach cargo:start to pre-integration-test phase, using existing type, so configuration from #2 is read-only used, and *should* not be overwritten.
In theory it seems all great and already working.
But I couldn't convince cargo to work like that.
Started executing maven with -X to discover that maven configures mojos properly, not a big surprise, especially if you take a look at CI of cargo, you would suspect cargo of errors.
At the end of a day I created this ugly but working configuration:



<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 <modelVersion>4.0.0</modelVersion>
 <groupId>your.group.id</groupId>
 <artifactId>itest</artifactId>
 <version>0.1-SNAPSHOT</version>
 <name>Integration Tests</name>
 <description>This module provides a collection of integration tests.</description>
 <packaging>jar</packaging>
 <dependencies>
  <dependency>
   <groupId>junit</groupId>
   <artifactId>junit</artifactId>
   <version>3.8.1</version>
   <scope>test</scope>
  </dependency>
  <dependency>
   <groupId>your.group.id</groupId>
   <artifactId>your-ear</artifactId>
   <type>ear</type>
   <version>${project.version}</version>
  </dependency>
  <dependency>
   <groupId>org.codehaus.cargo</groupId>
   <artifactId>cargo-ant</artifactId>
   <version>0.9</version>
   <scope>test</scope>
  </dependency>
  <dependency>
   <groupId>org.codehaus.cargo</groupId>
   <artifactId>cargo-core-uberjar</artifactId>
   <version>0.9</version>
   <scope>test</scope>
  </dependency>
 </dependencies>
 <build>
  <plugins>
   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <executions>
     <execution>
      <phase>integration-test</phase>
      <goals>
       <goal>test</goal>
      </goals>
     </execution>
    </executions>
   </plugin>
   <plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.1</version>
    <executions>
     <execution>
      <id>tune-deployment</id>
      <phase>generate-test-resources</phase>
      <goals>
       <goal>run</goal>
      </goals>
      <configuration>
       <tasks>
        <copy todir="${basedir}/target/jboss4x" overwrite="true">
         <fileset dir="${basedir}/src/jboss4x"/>
        </copy>
       </tasks>
      </configuration>
     </execution>
     <!-- This execution is needed to start container with existing configuration -->
     <execution>
      <id>start-container</id>
      <phase>pre-integration-test</phase>
      <goals>
       <goal>run</goal>
      </goals>
      <configuration>
       <tasks>
        <taskdef resource="cargo.tasks">
         <classpath refid="maven.test.classpath"/>
        </taskdef>
        <echo message="Starting Cargo..."/>
        <cargo containerId="jboss4x"
            home="${jboss4x.home}"
            output="${project.build.directory}/container.log"
            append="true"
            log="${project.build.directory}/cargo.log"
            action="start"
            wait="false">
         <configuration type="existing" home="${project.build.directory}/jboss4x">
          <property name="cargo.servlet.port" value="8982"/>
         </configuration>
        </cargo>
       </tasks>
      </configuration>
     </execution>
    </executions>
   </plugin>
   <plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <configuration>
     <wait>false</wait>
     <container>
      <containerId>jboss4x</containerId>
      <home>${jboss4x.home}</home>
      <output>${project.build.directory}/container.log</output>
      <append>true</append>
      <log>${project.build.directory}/cargo.log</log>
     </container>
     <configuration>
      <type>existing</type>
      <home>${project.build.directory}/jboss4x</home>
      <properties>
       <cargo.logging>high</cargo.logging>
      </properties>
     </configuration>
    </configuration>
    <executions>
     <execution>
      <id>stop-container</id>
      <phase>post-integration-test</phase>
      <goals>
       <goal>stop</goal>
      </goals>
     </execution>
     <execution>
      <id>create-deployment</id>
      <phase>generate-test-sources</phase>
      <goals>
       <goal>configure</goal>
      </goals>
      <configuration>
       <container>
        <containerId>jboss4x</containerId>
        <home>${jboss4x.home}</home>
        <output>${project.build.directory}/container.log</output>
        <append>true</append>
        <log>${project.build.directory}/cargo.log</log>
       </container>
       <configuration>
        <type>standalone</type>
        <home>${project.build.directory}/jboss4x</home>
        <properties>
         <cargo.jvmargs>
          -Xdebug -Xnoagent
          -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
         </cargo.jvmargs>
         <cargo.logging>high</cargo.logging>
         <cargo.servlet.port>8982</cargo.servlet.port>
        </properties>
        <deployables>
         <deployable>
          <groupId>your.group.id</groupId>
          <artifactId>your-ear</artifactId>
          <type>ear</type>
         </deployable>
        </deployables>
       </configuration>
      </configuration>
     </execution>
    </executions>
   </plugin>
  </plugins>
 </build>
</project>