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 7514457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:30:12+00:00 2026-05-30T00:30:12+00:00

I have a pom with 3 profiles defined. I want: run generate profile always

  • 0

I have a pom with 3 profiles defined.
I want:

  1. run “generate” profile always before all others (if needed)
  2. run dev/normal profile based on e.g properties
    pom snip:

    <profiles>
        <profile>
            <id>generate-axis-stubs</id>
            <activation>
                <file>
                    <missing>target/generated-sources</missing>
                </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.axis2</groupId>
                        <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
                        <configuration>
                            <generateServerSide>true</generateServerSide>
                            <generateServicesXml>true</generateServicesXml>
                            <outputDirectory>target/generated-sources</outputDirectory>
                            <packageName>${genclasses.package}</packageName>
                        </configuration>
                        <executions>
                            <execution>
                                <id>ESISGeneralSigningStatusUpdate_V1_0</id>
                                <goals>
                                    <goal>wsdl2code</goal>
                                </goals>
                                <phase>generate-sources</phase>
                                <configuration>
                                    <wsdlFile>${wsdl.src.dir}/ESISGeneralSigningStatusUpdate_V1_0.wsdl</wsdlFile>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    
        <profile>
            <id>normal</id>
            <activation>
                <property>
                    <name>!env</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <excludes>
                                <exclude>**/JdbcDataServiceImplTest.java</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    
    <!-- This profile should be used to run tests that requires access to DB It is activated in case system variable env=dev -->
    <profile>
        <id>run-db-tests</id>
        <activation>
            <property>
                <name>env</name>
                <value>dev</value>
            </property>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <includes>
                            <include>**/*Test.java</include>
                        </includes>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
    

The problem is that on clean compile this works exactly every 2nd time.
I’ve enabled the -X debug and compared the output.
– is the failed, + is the one that worked.

@@ -1551,6 +1551,10 @@
 [DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, 
generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, 
package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
 [DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
 [DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
+[DEBUG] Using mirror nexus (http://nexus.edb.com/nexus/content/groups/public/) for apache.snapshots (http://repository.apache.org/snapshots).
+[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
+[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
+[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
 [DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
 [DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
 [DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
@@ -1563,7 +1567,7 @@
 [DEBUG] === PROJECT BUILD PLAN ================================================
 [DEBUG] Project:       com.edb.esign:gssWsServer:2.3-SNAPSHOT
 [DEBUG] Dependencies (collect): []
-[DEBUG] Dependencies (resolve): [compile]
+[DEBUG] Dependencies (resolve): [compile, test]
 [DEBUG] Repositories (dependencies): [nexus (http://nexus.edb.com/nexus/content/groups/public/, releases+snapshots)]
 [DEBUG] Repositories (plugins)     : [nexus (http://nexus.edb.com/nexus/content/groups/public/, releases+snapshots)]
 [DEBUG] -----------------------------------------------------------------------

When I run help:active-profile

  1. after success it shows:
    The following profiles are active:

    • normal (source: pom)
    • nexus (source: settings.xml)
  2. after the failed one it shows:
    The following profiles are active:

    • generate-axis-stubs (source: pom)
    • normal (source: pom)
    • nexus (source: settings.xml)

If I manually clean it and then compile – it works all the time. But why doesn’t it work always for clean compile?
Thanks!

  • 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-30T00:30:14+00:00Added an answer on May 30, 2026 at 12:30 am

    Because profiles are evaluated exactly once. So the problem isn’t clean compile, it’s whether the folder target/generated-sources exists when you start Maven.

    If it exists, clean compile has to fail because the clean deletes the folder but Maven doesn’t care anymore.

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

Sidebar

Related Questions

I have defined the following profile in pom.xml: <profiles> <profile> <id>dev</id> <build> <plugins> <plugin>
I have two profiles in my pom.xml, dev and stage: <profiles> <profile> <id>dev</id> <properties>
I have added below profile to my pom.xml : <profiles> <profile> <id>nexus</id> <activation> <activeByDefault>true</activeByDefault>
I have a bunch of properties defined in pom.xml for different profiles. I would
What I want to do is this: I have a pom.xml that depends on
I have a super pom defined in which I specify a "resources" directory for
I have a maven pom.xml file with multiple instances of a same goal defined
I have a typical pom.xml, and want to print the groupId, artifactId and version,
I have a project with a parent pom.xml which define profiles, and a debug
I have a multi-module project, and I am using profiles in the parent pom

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.