Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7398201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:50:29+00:00 2026-05-29T03:50:29+00:00

I am trying to set-up conditional plugin execution via profiles. The idea is to

  • 0

I am trying to set-up conditional plugin execution via profiles. The idea is to have a compress/no compress HTML files:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>net</groupId>
    <artifactId>mavenconditionalexecution</artifactId>
    <version>1.0.0</version>
    <packaging>jar</packaging>

    <name>Maven Conditional Execution</name>

    <properties>
        <DoCompress>true</DoCompress>
    </properties>

    <build>
        <plugins>

            <!-- Clean-up -->
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.6</version>
                <executions>
                    <execution>
                        <phase>clean</phase>
                        <configuration>
                            <target>
                                <echo message="DoCompress: ${DoCompress}"/>
                                <delete includeemptydirs="true">
                                    <fileset dir="${basedir}/src/main/webapp/result/" includes="**/*"/>
                                </delete>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

        <resources>
          <resource>
            <directory>${basedir}/src/main/webapp/html</directory>
          </resource>
        </resources>

    </build>

    <profiles>

        <profile>
            <id>With Compression</id>
            <activation>
                <property>
                    <name>DoCompress</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.tunyk.mvn.plugins.htmlcompressor</groupId>
                        <artifactId>htmlcompressor-maven-plugin</artifactId>
                        <version>1.2</version>
                        <executions>
                            <execution>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>html</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <goalPrefix>htmlcompressor</goalPrefix>
                            <srcFolder>${basedir}/src/main/webapp/html</srcFolder>
                            <targetFolder>${basedir}/src/main/webapp/result/html</targetFolder>
                            <removeIntertagSpaces>true</removeIntertagSpaces>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>Without Compression</id>
            <activation>
                <property>
                    <name>DoCompress</name>
                    <value>false</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <phase>process-resources</phase>
                                <configuration>
                                    <target>
                                        <echo message="Copying file"/>
                                        <copy todir="${basedir}/src/main/webapp/result/">
                                            <fileset dir="${basedir}/src/main/webapp/html/" >
                                                <include name="angle.html"/>
                                            </fileset>
                                        </copy>
                                    </target>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>

        </profile>

    </profiles>

    <dependencies>
        <dependency>
            <groupId>com.tunyk.mvn.plugins.htmlcompressor</groupId>
            <artifactId>htmlcompressor-maven-plugin</artifactId>
            <version>1.2</version>
        </dependency>
    </dependencies>

</project>

It does not matter what value I assign to the DoCompress property, the corresponding profile are not executed. I check the value of the property with an echo. Why? What am I doing wrong?

Is it allowed to activate multiple profiles in a pom.xml using property values?

UPDATE

I have created an incident: I have created an incident: https://jira.codehaus.org/browse/MNG-5235.

If anyone has an operational example of maven profile activation by properties, I am interested. Moreover, does anyone know whether multiple profiles can be activated in the same run via properties? The documentation is not clear about it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T03:50:30+00:00Added an answer on May 29, 2026 at 3:50 am

    After opening an issue, it turns out this is not a bug, because properties in the section can only be system properties, not properties defined in the pom.xml itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small set of source code files for C. I'm trying to
I am trying to use set.insert (key) as a conditional, where if the key
I'm trying to set some conditional statements for nested embedRelation() instances, and can't find
I am trying to use a set of conditional statements that will set up
I am trying to set up caching correctly and have set Expires headers to
I'm trying to modify the vestal_versions plugin to accept a parameter I set upon
Trying to set it so if a certain condition is met then one of
Im trying set the single table inheritance model type in a form. So i
I am trying set up databinding as described in the title. The problem I
Trying to set up caching on our datasets - we're using clr stored procedures

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.