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, update… Continue Reading
java_home mac mavenGuide to create a web application with Maven, and add Spring MVC as web framework.
maven maven-project spring mvc web projectCreate a simple Java project from Maven template, and also showing how to compile, run unit test, and package the project into a jar file.
mavenThis 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 dependency… Continue Reading
manifest mavenIn 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 from… Continue Reading
jar maven maven pluginIn 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 same… Continue Reading
maven maven pluginCustom 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 jar… Continue Reading
maven propertiesBy 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 New… Continue Reading
eclipse maven pomProblem 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_REPO… Continue Reading
eclipse m2_repo mavenIn 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 3… Continue Reading
maven maven3Problem Using Maven build tool, which jar should include to use HttpServletRequest or HttpServletResponse? Solution To use HttpServletRequest or HttpServletResponse in development environment, include “serlvet-api.jar” in your Maven pom.xml file. <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. You need this… Continue Reading
maven maven repositoryThis 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 mapping… Continue Reading
annotation hibernate maven oracleIn this article, we show you how to integrate Maven3, Hibernate3.6 and Oracle11g together. In the end of this article, you will create a Java project with Maven, and insert a record into Oracle database via Hibernate framework. Tools & technologies used in this article : Maven 3.0.3 JDK 1.6.0_13… Continue Reading
hibernate maven oracle xml mappingDue to Oracle license restriction, there is NO public Maven repository provides Oracle JDBC driver. To use Oracle jdbc drive with Maven, you have to install it manually into your Maven local repository. Here’s a guide to show you how to add an Oracle JDBC driver (“ojdbc6.jar“) into your Maven… Continue Reading
jdbc maven maven repository oracle