lunes, 17 de septiembre de 2012

Working with Maven Profiles

Imagine that you have the following structure in your project.

As you can see, I have config folder where I have two more folders dev and prod. Each one has two file with the same name but different values.



Why do we do that?
We have different environments and each one has his own configuration. Instead of re-write the file properties we can use profiles using maven. Configuration is attached bellow:

In your pom.xml file you need that: If you want to build a new artifact using Dev profile you should run the following command:
mvn -Pdev clean package -Dmaven.test.skip

Maven Repository

Nowadays, we are working in several project using Maven. But, sometimes we got problem looking for some artifacts that we want to use. For that reason, I'm going to share some repositories that I have got set up in my maven projects or Nexus Repository.
You can use the following code in your pom.xml

NOTE: If you want to use in Nexus Repository or another Maven Repository, you will have to add each repository manually.