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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:25:00+00:00 2026-06-16T04:25:00+00:00

I need to use the Maven antrun plugin to add Hibernate bytecode instrumentation to

  • 0

I need to use the Maven antrun plugin to add Hibernate bytecode instrumentation to one of my Java classes, in order to enable lazy-loading of individual fields. However, I cannot get the plugin to execute during a build cycle.

How can I instruct Maven to execute the antrun plugin after compilation but before packaging during a mvn package build?

Current pom.xml (snippet):

<pluginManagement>
    <plugins>
    ...
        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.7</version>
            <inherited>false</inherited>
            <executions>
                <execution>
                    <id>default-cli</id>
                    <configuration>
                        <target>
                            <echo message="Running instrumentation task"/>
                            <taskdef name="instrument" classname="org.hibernate.tool.instrument.javassist.InstrumentTask">
                                <classpath>
                                    <path refid="maven.dependency.classpath" />
                                    <path refid="maven.plugin.classpath" />
                                </classpath>
                            </taskdef>
                            <instrument verbose="true">
                                <fileset dir="target/classes">
                                    <include name="**/UploadedFile.class" />
                                </fileset>
                            </instrument>
                        </target>
                    </configuration>
                    <phase>process-classes</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-core</artifactId>
                    <version>${hibernate.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.javassist</groupId>
                    <artifactId>javassist</artifactId>
                    <version>${javassist.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                    <version>${org.slf4j-version}</version>
                </dependency>
            </dependencies>
        </plugin>
    ...
    </plugins>
</pluginManagement>

All of the documentation I have seen regarding this issue shows the plugin being configured to run during the “process-classes” phase. However, from the Maven docs, it doesn’t appear that the “process-classes” phase is part of the build cycle for package. I can run the plugin on its own using mvn antrun:run, but since in the end I need to do mvn package to produce a .war file for deployment, I am fairly certain that this plugin needs to execute somewhere within the package task in order to place the modified class into the packaged .war.

I have tried many variations of the above code (changing the phase, changing with , updating the plugin’s version, changing the id, etc), with no perceivable changes. I have been running mvn with -e -X to display all possible output, and the antrun plugin is never executed no matter what I try. Any help would be greatly appreciated.

  • 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-06-16T04:25:01+00:00Added an answer on June 16, 2026 at 4:25 am

    Apparently, the problem is in the fact that your antrun plugin configuration is located in pluginManagement section instead of plugins section. You can see the difference between these 2 sections in my answer here.

    To make it work you should move this to <build> -> <plugins> section of your pom.xml.

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

Sidebar

Related Questions

I use maven-antrun-plugin for init config files for my project. But i need to
I need to use Maven to add a new buildCommand in my .project file.
I have a maven project that contains a certain api I need to use
I need use this method with three distinct classes: Orders, Customers, Suppliers public void
I code mostly in Java and use Maven for all of my projects. I
For the Flyway Maven plugin, I need to call a number of libraries that
I created Android Maven Project with android-quickstart-archetype ( https://github.com/akquinet/android-archetypes/wiki/android-quickstart-archetype ) I need to use
My greetings! I use maven to build my app and I need to change
Most Hibernate tutorials use Maven for handling the build, but I'm looking for a
I have a scala project that I use Maven and the maven-scala-plugin to compile.

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.