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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:00:10+00:00 2026-05-23T23:00:10+00:00

I am using maven-antrun-plugin to generate classes using Apache Thrift. The plugin works when

  • 0

I am using maven-antrun-plugin to generate classes using Apache Thrift. The plugin works when I specify one thrift file as an argument but fails when I try using a wildcard (*) to generate code for all thrift files. I executed thrift from the command line:

thrift --gen java:beans src/main/resources/*.thrift

And this works.

But when I define this plugin in my pom.xml

            <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
                <execution>
                    <id>generate-sources</id>
                    <phase>generate-sources</phase>
                    <configuration>
                        <tasks>
                            <mkdir dir="target/generated-sources" />
                            <exec executable="${thrift.executable}" failonerror="true">
                                <arg value="--gen" />
                                <arg value="java:beans" />
                                <arg value="-o" />
                                <arg value="target/generated-sources" />
                                <arg value="${basedir}/src/main/resources/*.thrift" />
                            </exec>
                            <copy todir="src/main/java" overwrite="true">
                                <fileset dir="target/generated-sources/gen-javabean" />
                            </copy>
                        </tasks>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

The above fails with error “Could not open input file with realpath”.

How do I specify wildcards using maven-antrun-plugin?

  • 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-23T23:00:11+00:00Added an answer on May 23, 2026 at 11:00 pm

    You should rather use the maven thrift plugin.
    I assume that arg escapes the * and passes as is. Your first command works because the shell does expand the * for you. Thrift ist not able to expand the wildcard itself.

    Besides that, the directories use are tremendously wrong.

    Edit your file should read:

    <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
                <execution>
                    <id>generate-sources</id>
                    <phase>generate-sources</phase>
                    <configuration>
                        <tasks>
                            <!-- always use properties if available -->
                            <mkdir dir="${build.directory}/generated-sources" />
                            <exec executable="${thrift.executable}" failonerror="true">
                                <arg value="--gen" />
                                <arg value="java:beans" />
                                <arg value="-o" />
                                <arg value="${build.directory}/generated-sources/thrift" />
                                <!-- since this is a special type of source, it has to be in its own dir -->
                                <arg value="src/main/thrift/*.thrift" />
                            </exec>
                                <!-- You never ever copy generated stuff back into src/* -->
                                <!-- use Build Helper Maven Plugin to add the generated source -->
                                <copy todir="src/main/java" overwrite="true">
                                <fileset dir="target/generated-sources/gen-javabean" />
                            </copy>
                        </tasks>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the FTP Ant task with maven-antrun-plugin <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>ftp</id>
im using maven-jaxb2-plugin to generate from a 1.0xsd file: <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <executions> <execution>
I'm using maven-minify-plugin. It can produce only one output file. I need to produce
I am using maven-exec-plugin to generate java sources of Thrift. It invokes the external
I am using maven jar plugin to package the jar file. But it looks
I am using Maven Assembly plugin to pack a jar file. But when I
I'm using the build-helper-maven-plugin to add it to my build, but I'd like to
I am using Maven, with the one-jar pluggin, but when I run the one
I am using antrun plugin in my maven build to replace a token @version@
I am using maven-buildnumber-plugin version 1.0-beta-4. This works fine on a project checked out

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.