Maven TutorialIntroduction to Maven Installation and environment configuration Maven settings Standard directory structure in Maven project command line IntelliJ IDEA Super POM and Parent POM Understanding POM.xml file Declaring maven dependencies Dependency management using repositories in Maven Adding jar file as a dependency in Maven Maven archetypes Maven build life cycle, phases and goals Generating project API documentation Generating Site documentation for a project Installing artifacts in local repository Deploying the artifact on remote repository Maven plug-ins surefire plugin compiler plugin Profiles in MavenExecuting Maven phases and goals through command prompt Maven command line optionsexec-maven-plugin usage Skipping tests in Maven Test execution report in Maven
Profiles in MavenBuild process may differ based upon environments like development, production etc. It may also differ based on operating system. So how to configure maven so that based on certain conditions, specific build process should be used? That’s when Profiles come in to picture. With the help of Profile, we can execute the build process with required tweaks. We can define profiles in 2 places.
Sometimes, we might need to activate specific profile by default. For that, you can use below lines of code.
<profiles> <profile> <id>windows-build</id> <activation> <os> <family>windows</family> </os> </activation> </profile> <profile> <id>unix-build</id> <activation> <os> <family>unix</family> </os> </activation> </profile> </profiles>
You can also activate the profile at command line using below statements. Below line will choose windows-build profile.
<activation> <activeByDefault>true</activeByDefault> </activation>
Below line will choose all profiles except xyz to complete the build process.
mvn test -P windows-build
mvn test -P !xyz
Complex problems, Simple Solutions