Tag : maven

maven-logo

Maven site build is very slow – dependency report

Creating a Maven site, but the build is very slow to generate the dependency report. C:\mkyong_projects\>mvn site [INFO] Scanning for projects… [INFO] [INFO] ————————————– [INFO] Building Maven Webapp 1.0-SNAPSHOT [INFO] ————————————– [INFO] //… [INFO] Generating "Project License" report [INFO] Generating "Project Team" report [INFO] Generating "Project Summary" report [INFO] GeneratingContinue Reading

java_logo_100

Emma – Class x appears to be instrumented already

Review the “maven-emma-plugin” in pom.xml : pom.xml <project> //… <build> <plugins>   <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>emma-maven-plugin</artifactId> <version>1.0-alpha-3</version> <inherited>true</inherited> <executions> <execution> <phase>process-classes</phase> <goals> <goal>instrument</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <inherited>true</inherited> <configuration> <forkMode>once</forkMode> <reportFormat>xml</reportFormat> <classesDirectory> ${project.build.directory}/generated-classes/emma/classes </classesDirectory> </configuration> </plugin>   </plugins> </build> </project> 1. Problem When I run the command mvnContinue Reading

apple-logo

Maven, JAVA_HOME is not defined correctly on Mac OSX

Apple recommends to set JAVA_HOME to “/usr/libexec/java_home“, for example : $ vim .bash_profile   export JAVA_HOME=/usr/libexec/java_home   $ source .bash_profile But, when execute the Maven command, it prompts following error messages : $ mvn -version Error: JAVA_HOME is not defined correctly. We cannot execute /usr/libexec/java_home/bin/java Solution To fixed it, updateContinue Reading

maven-logo

How to create a Web Application Project with Maven

Guide to create a web application with Maven, and add Spring MVC as web framework.

maven-logo

How to create a Java project with Maven

Create a simple Java project from Maven template, and also showing how to compile, run unit test, and package the project into a jar file.

maven-logo

How to create a manifest file with Maven

This tutorial will show you how to use the maven-jar-plugin to create a manifest file, and package / add it into the final jar file. The manifest file is normally used to define following tasks : Define the entry point of the Application, make the Jar executable. Add project dependencyContinue Reading

java jar with maven

How to create a jar file with Maven

In this tutorial, we will show you how to use Maven to create a Java project from template and package it into a jar file, make the jar file executable. Tools used : JDK 1.6 Maven 3 Eclipse 4.2 1. Java Project from Maven Template Create a Java project fromContinue Reading

maven-logo

Maven plugin – execution order in same phase

In Maven, you can use the build lifecycle or phases to control the order of the plugin execution. In some scenario, you have to bound few plugins to same phase, but still want to control the order of the plugin execution. But, the order is not executed in the sameContinue Reading

maven-logo

How to create user defined properties in Maven

Custom properties or variables are useful to keep your Maven pom.xml file more easy to read and maintain. File : pom.xml <project> … <properties> <my.plugin.version>1.5</my.plugin.version> </properties> … </project> In above pom.xml, you can refer “my.plugin.version” via code ${my.plugin.version}. Example 1 A classic use case is used to define a jarContinue Reading

maven-logo

Eclipse code assist in Maven pom.xml

By default, code assist in editing a pom.xml is NOT supported in Eclipse IDE. It make Maven project hard to maintain, and who will remember who all those tags? Solution You need a pom.xml Maven editor, which is available in m2eclipse plugin. In Eclipse, menu, select “Help” -> “Install NewContinue Reading

mac logo

How to install Maven on Mac OSX

By default, Maven 3 is installed on Mac OSX.

maven-logo

Maven M2_REPO is non modifiable

Problem Forgot what i did, may be installed m2eclipse plguin, it made the M2_REPO classpath variable is unable to edit. Select Windows -> Preferences -> Java -> Build Path -> Classpath Variables. Eclipse come with embedded Maven and have this M2_REPO classpath variable default non modifiable also. Figure – M2_REPOContinue Reading

default thumbnail

Maven 3 need to know the plugin version

In Maven 2, if you didn’t specify the version for each plugins that used in pom.xml, it will pick the latest plugin version automatically, which is very convenient. However, in Maven 3, if you didn’t explicitly specify the plugin version, it will prompt you warning message. Read this “Maven 3Continue Reading

default thumbnail

Get HttpServletRequest via Maven repository

Problem Using Maven build tool, which jar should include to use HttpServletRequest or HttpServletResponse? Solution To use HttpServletRequest or HttpServletResponse in a development environment, include servlet-api. jar in your Maven pom.xml file. pom.xml <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> Put scope as provided, because most j2ee containers have this jar.Continue Reading

default thumbnail

Maven 3 + Hibernate 3.6 + Oracle 11g Example (Annotation)

This tutorial will reuse and modify the previous Hibernate3.6 XML mapping tutorial, but replace the Hibernate mapping file (hbm) with Hibernate / JPA Annotation code. Technologies in this article : Maven 3.0.3 JDK 1.6.0_13 Hibernate 3.6.3.final Oracle 11g 1. pom.xml No change in pom.xml file, all previous Hibernate3.6 XML mappingContinue Reading

Page 1 of 512345