# profiles

* Using a profile to run a build.
* Can run each profile using mvn clean verify -P
* Can activate multiple profiles mvn clean verify -P ,
* USe of maven-help-plugin, to display active profile at compile time
  * ```
    <build>
          <plugins>
              <!-- display active profile in compile phase -->
              <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-help-plugin</artifactId>
                  <version>3.1.0</version>
                  <executions>
                      <execution>
                          <id>show-profiles</id>
                          <phase>compile</phase>
                          <goals>
                              <goal>active-profiles</goal>
                          </goals>
                      </execution>
                  </executions>
              </plugin>

          </plugins>
      </build>
    ```
  * use profiles to set properties

    * ```
      ```

    no-tests true \`\`\`
* we can configure many elements such as dependencies, plugins, resources, finalName.
* Activating profile by default

  * ```
    ```

  integration-tests true \`\`\` - Dont need to use -P to run the profile - If we use the -P, this will use the profile instead of the default one
* Activate automatically, based on env variable -D
  * ```
    <profile>
      <id>active-on-property-environment</id>
      <activation>
          <property>
              <name>environment</name>
          </property>
      </activation>
    </profile>
    ```
  * mvn package -Denvironment
  * Or by the absence
    * ```
      <profile>
          <id>not-active-on-property-environment</id>
          <activation>
              <property>
                  <name>!environment</name>
              </property>
          </activation>
      </profile>
      ```
    * So calling mvn package -Denvironment will not run this profile


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hanfak.gitbook.io/workspace/devops1/build-tools/maven/profiles.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
