Questions tagged [maven-profiles]

Profiles are intended to give some extra behaviors to maven builds, with a set of properties, plugin or actions

Introduction to Build Profiles

Maven 2.0 introduces the concept of a build profile. Profiles are specified using a subset of the elements available in the POM itself (plus one extra section), and are triggered in any of a variety of ways.

They modify the POM at build time, and are meant to be used in complementary sets to give equivalent-but-different parameters for a set of target environments (providing, for example, the path of the appserver root in the development, testing, and production environments).

As such, profiles can easily lead to differing build results from different members of your team. However, used properly, profiles can be used while still preserving project portability. This will also minimize the use of -f option of maven which allows user to create another POM with different parameters or configuration to build which makes it more maintainable since it is runnning with one POM only.

What are the different types of profile? Where is each defined?

Per Project - Defined in the POM itself (pom.xml).

Per User - Defined in the Maven-settings (%USER_HOME%/.m2/settings.xml).

Global - Defined in the global Maven-settings (%M2_HOME%/conf/settings.xml).

Profile descriptor - a descriptor located in project basedir (profiles.xml) (unsupported in Maven 3.0: see Maven 3 compatibility notes)

Sources and official site : http://maven.apache.org/guides/introduction/introduction-to-profiles.html

248 questions
0
votes
1 answer

Exception while executing integration tests in maven

Getting following exception while executing integration tests using mvn verify against my webapp. The integration tests just loads the server url using HtmlUnit and checks for the status code 200. Not sure what I am missing here. It looks like the…
Nital
  • 5,784
  • 26
  • 103
  • 195
0
votes
1 answer

The version of the artifactItem is not defaulting to the version from the dependencies or dependencyManagement when we use multiple profiles?

I'm working with maven. As present in this link : http://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-artifacts.html (Second case) , we can remove the tag present if the artifact is listed as a dependency. Because the version…
Pranesh
  • 43
  • 9
0
votes
1 answer

Use a custom database.properties file only in production in a resthub bootstrapped maven java project running in Intellij

I am using resthub to bootstrap my spring-backbone webapp. https://github.com/resthub/resthub.github.io/blob/master/docs/spring/layout.md#environment-specific-properties According to…
coding_idiot
  • 13,526
  • 10
  • 65
  • 116
0
votes
1 answer

How can I minimize Maven POM.XML file

I am new to Maven and I'm trying to make some improvements on an existing project. I am sure there's an efficient way to build a profile with parameters or somehow reduce the lines size of the tasks. The current profiles are built like this one: …
mor mazar
  • 1
  • 1
  • 1
0
votes
1 answer

overriding system properties in maven

I have a web application with a couple of profiles - for production and for local testing; build is executed with maven; logback is used for logging so some of logs write to files - the problem is: in production we use tomcat and CATALINA_HOME is…
tania
  • 1,086
  • 2
  • 12
  • 31
0
votes
1 answer

How can I use maven profiling to a dependant

Is there a way to use profile to a dependent class in maven profiling. My problem is that, I have two projects under one parent. product-core-ws and product-core. product-core-ws is a deplorable web service.Now I want to create two profiles inside…
Ravindu
  • 2,408
  • 8
  • 30
  • 46
0
votes
1 answer

Maven call automatically the release prepare when activated a profile

I do not have much experience with Maven profiles .... I do not know if Maven can do this, but it definitely could be useful to me ... Is possible to define a profile, which when called, automatically run the maven release plugin prepare goal? I…
ivoruJavaBoy
  • 1,307
  • 2
  • 19
  • 39
0
votes
1 answer

Managing different dependency contexts in java (maven) project

I have an applicatoin where all the code is very cohesive, but runs in different class environments. The application does the same thing many ways, using different APIs. I want to thus have different parts of the build run with different…
jayunit100
  • 17,388
  • 22
  • 92
  • 167
0
votes
1 answer

Maven not using correct profile when building via parent POM

I have a Maven project which uses profiles to inject application properties at build time. The properties that get injected are stored in the Maven settings file which i use when asking Maven to build the project. My build command can take two…
cdugga
  • 3,849
  • 17
  • 81
  • 127
0
votes
0 answers

Bad injection of maven properties in spring application context

I am trying to set up an activeMQ broker and apply it the following policyEntry:
Antonio Acevedo
  • 1,480
  • 3
  • 21
  • 39
0
votes
0 answers

Can I use a Maven Profile to deploy a file to the repo?

We have a devconfig project that contains files such as findbugs-global-exclude.xml among other things. I want to turn this into a Maven project with profiles to deploy the different parts. So in my head, the command would be something like…
Snekse
  • 15,474
  • 10
  • 62
  • 77
0
votes
1 answer

All maven flyway plugins are executed with the last user

I have two oracle users and I am creating different schema for them. I mean each schema has different tables, types etc. I wanted to create both schemas by flyway maven plugin, first I had two maven plugins, but then I tried also to have two…
Cipous
  • 952
  • 7
  • 19
0
votes
1 answer

Maven Pom Parent Child Profile issues

I have profiles defined in the parent pom.xml and child pom.xml but when I try to run mvn install -P profile name from the parent project, the properties defined in the profile file are not being copied My Parent pom.xml looks like: …
user665837
  • 345
  • 1
  • 3
  • 7
0
votes
1 answer

deploy maven artifact with multiple profile dependencies

We are relatively new to Maven and now face a problem. We have a Maven project (projectA) whose JAR is the dependency of several other projects. Some of the other projects are some custom web container while others are not, so some of projectA's…
0
votes
2 answers

Maven profiles: maven-antrun-plugin & maven-war-plugin interaction

I have a Spring framework project with the following three files in src/main/webapp/WEB-INF: project.propterties project-servlet.xml project-security.xml I am trying to use maven profiles as follows to 'inject' the above mentioned files in the case…
kmansoor
  • 4,265
  • 9
  • 52
  • 95
1 2 3
16
17