Support

Forums

Contact Me

Posts Tagged 'maven'

MAVEN

Mars Atmosphere and Volatile EvolutioN (MAVEN) is a planned space exploration mission to send a space probe to orbit Mars. [http://en.wikipedia.org/wiki/MAVEN]

Continuous build of Apache projects

Apache foundation is using Hudson for continuous build (and also JBOSS)

Hudson monitors executions of repeated jobs, such as building a software project or jobs run by cron.
Among those things, current Hudson focuses on the following two jobs:

  1. Building/testing software projects continuously, just like CruiseControl or DamageControl.
    In a nutshell, Hudson provides an easy-to-use so-called continuous integration system,
    making it easier for developers to integrate changes to the project, and making it easier
    for users to obtain a fresh build. The automated, continuous build increases the productivity.
  2. Monitoring executions of externally-run jobs, such as cron jobs and procmail jobs, even those
    that are run on a remote machine. For example, with cron, all you receive is regular e-mails that
    capture the output, and it is up to you to look at them diligently and notice when it broke.
    Hudson keeps those outputs and makes it easy for you to notice when something is wrong.

This is a public build and test server for various Apache Projects.

 


 

An Eclipse plugin is also available the online WIKI is HERE

If you are shopping for a build server, and you are not on a budget, I can recommend you the
excellent Team City from JetBrains. Maven integration is also good, but wont probably never reach the level
of Hudson as it is made by Apache and tailored for their frameworks needs.

Keep your software stack up to date with the Apache Maven Versions Plugin

apache_maven

It is not unusual in a project to have a huge number of third party artifacts and Plug-in. Apache Maven help you keep track of them, along with their transitive dependencies.

But how do you know when a new version of an artifact is available?  This is where the Maven Versions plug-in come hand in.

The Versions Plug-in is used when you want to manage the versions of artifacts in a project's POM.

By running

mvn versions:display-dependency-updates

in any Apache Maven project or modules, you’ll get for example (we have a lot of 25 Maven modules, here is only one presented as an example, the list being too long)

[INFO] --------------------------------------------------------------------------------------------------
[INFO] Building Unnamed - com.innoveo:skye-services-api:jar:2.2.0-M-06
[INFO] --------------------------------------------------------------------------------------------------
[INFO]
[INFO] The following dependencies in Dependency Management have newer versions:
[INFO]   junit:junit ............................................. 4.4 -> 4.8.1
[INFO]   log4j:log4j ......................................... 1.2.15 -> 1.2.16
[INFO]   org.springframework:spring ...................... 2.5.6 -> 2.5.6.SEC02
[INFO]   org.springframework:spring-test ............... 2.5.6 -> 3.0.4.RELEASE

Read more: Keep your software stack up to date with the Apache Maven Versions Plugin

Apache Maven profiles order in multi modules projects

apache_maven

In which order are Apache Maven profiles executed? are Apache Maven profiles ordered? how can you insured that Apache Maven profiles are activated in the right order?

You normally don’t end up with these questions, issues may only appear if

  • Some profiles are dependent each other,
  • Some profiles can not run in any order,

The use case behind this article is very simple, as I have a a continuous build were:

  • 5 web applications have  to be deployed into a remote tomcat in phase pre-integration-test,
  • 2 databases are created for test cases in phase generate-test-resources
  • 1 more database is created and needed for runtime, done in phase pre-integration-test
  • One of these web applications is able to inject data into database using web services, a profile do this in a profile in phase pre-integration-test
  • Selenium test cases are run in phase integration-test

All these steps are done using several Apache Maven pom profiles.

As it is a bit complicated to explain, lets first refresh some Apache Maven concepts

Read more: Apache Maven profiles order in multi modules projects

Behavior Driven Development with JBehave and Apache Maven

apache_maven

jbehave-logo

I won’t explain you how to write any JBehave tests as the online documentation is more than complete.

I prefer to show you how to make them run in eclipse, and in Apache Maven as the example were not easy to run (scenario are wrongly in src/main/java).

 

JBehave is a framework for Behaviour-Driven Development
Behaviour-driven development (BDD) is an evolution of test-driven development (TDD) and acceptance-test driven design, and is intended to make these practices more accessible and intuitive to newcomers and experts alike.
It shifts the vocabulary from being test-based to behaviour-based, and positions itself as a design philosophy.
You can find out more about behaviour-driven development on the BDD wiki, or in the article Introducing BDD

Features of JBehave include:

  • Pure Java implementation, which plays well with Java-based enterprises.
  • Users can specify and run text-based user stories, which allows "out-in" development.
  • Annotation-based binding of textual steps to Java methods, with auto-conversion of string arguments to any parameter type (including generic types) via custom parameter converters.
  • Annotation-based configuration and Steps class specifications
  • Dependency Injection support allowing both configuration and Steps instances composed via your favourite container (Guice, PicoContainer, Spring).
  • Extensible story reporting: outputs stories executed in different human-readable file-based formats (HTML, TXT, XML). Fully style-able view.
  • Auto-generation of pending steps so the build is not broken by a missing step, but has option to configure breaking build for pending steps.
  • Localisation of user stories, allowing them to be written in any language.
  • IDE integration: stories can be run as JUnit tests or other annotation-based unit test frameworks, providing easy integration with your favourite IDE.
  • Ant integration: allows stories to be run via Ant task
  • Maven integration: allows stories to be run via Maven plugin at given build phase

To make the online sample run easily without having to check out the whole tree of JBehave, I will show you that by slightly altering the pom.xml of a sample (Trader), you can run them against a fix version of JBehave.

The whole pom.xml



    jbehave
    
        false
    
    
      
        
            org.apache.maven.plugins
            maven-dependency-plugin
            
                
                    unpack-jbehave-site-resources
                    generate-resources
                    
                        unpack
                    
                    
                        false
                        true
                        
                            
                                org.jbehave.site
                                jbehave-site-resources
                                2.0.2
                                
                                    ${project.build.directory}/jbehave-reports/rendered
                                
                            
                        
                    
                
                
                    unpack-jbehave-reports-resources
                    generate-resources
                    
                        unpack
                    
                    
                        false
                        true
                        
                            
                                org.jbehave
                                jbehave-core
                                ${jbehave.version}
                                
                                    ${project.build.directory}/jbehave-reports/rendered 
                                
                                
                                    **\/*.css,**\/*.ftl,**\/*.js
                                
                            
                        
                    
                
            
        
        
            org.jbehave
            jbehave-maven-plugin
            ${jbehave.version}
            
                
                    run-scenarios-found
                    integration-test
                    
                        
                            
                                **/scenarios/*.java
                            
                        
                        
                            
                                **/i18n/scenarios/*.java
                            
                        
                        false
                        
                            true
                        
                        false
                        
                        test
                    
                    
                        run-scenarios
                    
                
                
                    run-i18n-scenarios-found
                    integration-test
                    
                        
                            
                                **/i18n/scenarios/*.java
                            
                        
                        false
                        
                            true
                        
                        test
                    
                    
                        run-scenarios
                    
                
                
                    stepdoc
                    integration-test
                    
                        
                            
                                **/scenarios/*.java
                            
                        
                        
                            
                                **/scenarios/None.java
                            
                        
                        false
                        test
                        false
                        
                    
                    
                        stepdoc
                    
                
                
                    render-reports-generated
                    post-integration-test
                    
                        
                            txt
                            html
                            xml
                        
                        test
                        true

                    
                    
                        render-reports
                    
                
            
        
        
    
  
    true
    
        
            org.jbehave
            jbehave-maven-plugin
            ${jbehave.version}
             
            
                
                    
                        render-reports
                    
                
            
        
    
  

Auto deployment of Maven artifacts to Oracle Weblogic

apache_maven

I found  this time a  new way to deploy Maven artefacts using the Oracle Weblogic Ant API!

If you remember my previous post, there is many ways to deploy your war/ear to Oracle Weblogic

  1. Using Oracle Weblogic development mode, a mode in which a simple copy of your files in a specific autodeploy directory trigger the update/install of these
  2. Using Maven Cargo, this work only if your Oracle Weblogic container is local (see here) on the same machine, where Apache Maven is running
  3. Using a very old Maven plugin (2008), local and remote container are supported, but our builds were sometimes hanging during pre integration phase for no apparent reasons.

And now using the official ANT API of Oracle, by far the MOST stable of all!

Read more: Auto deployment of Maven artifacts to Oracle Weblogic

Apache Maven Archetype for Joomla

Got this email from Cyprian Sniegota, he did develop a Maven Archetype for easing development of Joomla extensions. His archetype currently support the creation of a skeleton for components, modules, plugins and templates.

I noticed some time ago that you described combination of Joomla! and Maven. Few weeks ago i wrote joomla-maven-plugin with skeleton projects (sources: bitbucket.org/deviapps) based on php-maven.org work.
Here is short description http://deviapps.com/create-joomla-extension-with-maven and 5 min video (in Polish so far) http://www.youtube.com/watch?v=aE8w9EZciTg
I hope you will be interested.

Thanks to him for having written this project. I will also try to Maven-ize what Joomla has done with Ant in the future (I prefer now crystal clear software lifecycle )

When using Maven jetty:run, CSS and JavaScript files are never updated

apache_maven

 jetty-logo-80x22

I was getting mad because jetty was refusing to redeploy my static files (xhtml, css) in Eclipse until I find the reason

The Jetty Web Server provides a HTTP server and Servlet container capable of serving static and dynamic contend either from a standalone or embedded instantiations.

Jetty buffers static content for webapps such as html files, css files, images etc and uses memory mapped files to do this if the NIO connectors are being used. The problem is that on Windows, memory mapping a file causes the file to be locked, so that the file cannot be updated or replaced. This means that effectively you have to stop Jetty in order to update a file.

To fix this, add a line with to your maven-jetty-plugin configuration:

org.mortbay.jetty 
maven-jetty-plugin 
6.1.5
   
  ... 
  src/main/resources/webdefault.xml 
  

The default webdefault.xml file is found in the lib/jetty.jar at org/mortbay/jetty/webapp/webdefault.xml. Extract it to a convenient disk location and edit it to change useFileMappedBuffer to false:

 
    useFileMappedBuffer 
     false 
   

Copy the changed file into src/main/resources/ of your project.

The problem is explained more in Jetty's documentation.

I was fighting today against Apache Maven release plugin with multi modules projects

apache_maven

I was fighting today against the maven-release-plugin of maven, solving complicated  errors in a row. As I am convince I made all possible errors,   I think it is worse to compile my findings here to help others :-)

Maven Release Plugin

This plugin is used to release a project with Maven, saving a lot of repetitive, manual work. Releasing a project is made in two steps: prepare and perform.

My approach to speed up things is always to define a small project (in a sandbox SVN root) that is compiling and running in 10 seconds to make some test before trying to make it run on our bigger Innoveo Skye(tm) product (35 modules)

I always have 2 projects prepared:

  • One TestSimpleProject: one Maven project with no code
  • One TestComplexProject: one maven project and 2 Maven sub modules

For the reader that can not wait here is the running command line from TeamCity to be put in Build Runner Goals

release:clean release:prepare release:perform -Dusername=xxxxxxx -Dpassword=yyyyyy

Read more: I was fighting today against Apache Maven release plugin with multi modules projects

Apache Maven BEA Weblogic 10.3 remote deployment

 apache_maven

In this small post I will show you how to deploy automatically some artifacts of your build into bea_logo1Weblogic 10.3 by using the weblogic-maven-plugin

This plugin will support various tasks within the Weblogic 8.1 and 9.x environment. Such tasks as deploy, undeploy,clientgen,servicegen, and appc are supported as well as many others. The plugin uses exposed API's that are subject to change but have been tested in 8.1 SP 4-6 and 9.0 - 9.2 MP3. There are two versions of the plugin to support the two environments based on differences in the JDK. The 9.x version is currently being refactored to support the standard JSR supported deployment interface

Read more: Apache Maven BEA Weblogic 10.3 remote deployment

Continuous build with Apache Maven

apache_maven

Maven is a software tool for Java project management and build automation created by Jason van Zyl in 2002. It is similar in functionality to the Apache Ant tool (and to a lesser extent, PHP's PEAR and Perl's CPAN), but has a simpler build configuration model, based on an XML format. Maven is hosted by the Apache Software Foundation, where it was formerly part of the Jakarta Project.

Maven uses a construct known as a Project Object Model (POM) to describe the software project
being built, its dependencies on other external modules and components, and the build order.
It comes with pre-defined targets for performing certain well defined tasks such as compilation
of code and its packaging.

A key feature of Maven is that it is network-ready. The core engine can dynamically download
plug-ins from a repository
, the same repository that provides access to many versions of different
Open Source Java projects, from Apache and other organizations and developers. This repository
and its reorganized successor, the Maven 2 repository, strives to be the de facto distribution
mechanism for Java applications, but its adoption has been slow. Maven provides built in support
not just for retrieving files from this repository, but to upload artifacts at the end of the build.
A local cache of downloaded artifacts acts as the primary means of synchronizing the output of
projects on a local system.

Maven is based on a plugin-based architecture that allows it to make use of any application
controllable through standard input. Theoretically, this would allow anyone to write plugins to
interface with build tools (compilers, unit test tools, etc.) for any other language.
from WikiPedia

Donations

Thank You for supporting my work