background preloader

Maven

Facebook Twitter

Welcome to Apache Maven. Installing 3rd party jars. Although rarely, but sometimes you will have 3rd party JARs that you need to put in your local repository for use in your builds, since they don't exist in any public repository like Maven Central. The JARs must be placed in the local repository in the correct place in order for it to be correctly picked up by Apache Maven. To make this easier, and less error prone, we have provide a goal in the maven-install-plugin which should make this relatively painless.

To install a JAR in the local repository use the following command: mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \ -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging> If there's a pom-file as well, you can install it with the following command: mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pomfile> With version 2.5 of the maven-install-plugin it gets even better.

Mvn install:install-file -Dfile=<path-to-file> Maven Compiler plugin - Introduction. The Compiler Plugin is used to compile the sources of your project. Since 3.0, the default compiler is javax.tools.JavaCompiler (if you are using java 1.6) and is used to compile Java sources. If you want to force the plugin using javac, you must configure the plugin option forceJavacCompilerUse. Also note that at present the default source setting is 1.5 and the default target setting is 1.5, independently of the JDK you run Maven with. If you want to change these defaults, you should set source and target as described in Setting the -source and -target of the Java Compiler. Other compilers than javac can be used and work has already started on AspectJ, .NET, and C#. This Compiler Plugin corresponds to Maven 1.x's Java Plugin. NOTE: To know more about the JDK javac, please see: Goals Overview The Compiler Plugin has two goals. Usage. Maven Ear plugin - ear:ear. Builds J2EE Enterprise Archive (EAR) files.

Parameter Details The location of a custom application.xml file to be used within the EAR file. : java.lang.String : No : org.apache.maven.archiver.MavenArchiveConfiguration The artifact type mappings. : org.codehaus.plexus.configuration.PlexusConfiguration Classifier to add to the artifact generated. The default bundle dir for libraries. Single directory for extra files to include in the EAR. : java.io.File : Yes : ${basedir}/src/main/application The comma separated list of tokens to exclude from the EAR.

The comma separated list of tokens to include in the EAR. Character encoding for the auto-generated deployment file(s). Expression preceded with this String won't be interpolated \${foo} will be replaced with ${foo}. : maven.ear.escapeString To escape interpolated value with Windows path c:\foo\bar will be replaced with c:\\foo\\bar. : boolean : maven.ear.escapedBackslashesInFilePath : false Specify that the EAR sources should be filtered. : java.util.List. Maven secrets: filtering sources - Connect. The default Maven root project object model provides very good defaults that declare what needs to be done in most cases.

Sometimes you need a bit more or different and Maven lets you do that. In this first episode I’ll show you how to filter your source files. Why filter source files? Well there are many use cases you can think of. Any build time property that you want to have available runtime can be stored in a class member variable in your code. It may be the datetime, the svn revision or whatever. A common use case when working with GX WebManager Components is that you want to use the ${pom.groupId} and ${pom.artifactId} to construct your component identifiers. Public static final String DOMAIN = "${pom.groupId}"; public static final String WCB_ID = "${pom.artifactId}"; Note: We could discuss if this is a good approach compared to using resource files (that are filtered by default) and can be loaded from the classpath at runtime, but that is beyond the scope of this post ;) Conclusion.

Maven Getting Started Guide. What is Maven? At first glance Maven can appear to be many things, but in a nutshell Maven is an attempt to apply patterns to a project's build infrastructure in order to promote comprehension and productivity by providing a clear path in the use of best practices. Maven is essentially a project management and comprehension tool and as such provides a way to help with managing: BuildsDocumentationReportingDependenciesSCMsReleasesDistribution If you want more background information on Maven you can check out The Philosophy of Maven and The History of Maven. Now let's move on to how you, the user, can benefit from using Maven. How can Maven benefit my development process? Maven can provide benefits for your build process by employing standard conventions and practices to accelerate your development cycle while at the same time helping you achieve a higher rate of success. How do I setup Maven? How do I make my first Maven project?

On to creating your first project! And the default excludes are: Maven: The Complete Reference / Documentation Sonatype.com.