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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:14:47+00:00 2026-05-26T04:14:47+00:00

I want to do a javac inside an antrun plugin based on the availability

  • 0

I want to do a “javac” inside an antrun plugin based on the availability of a file. How do we add conditions inside the 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-26T04:14:48+00:00Added an answer on May 26, 2026 at 4:14 am

    You can do this with help of Maven AntRun Plugin.

    In the sample ant script executes on clean phase and Ant-Contrib library was used:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.6</version>
                <executions>
                    <execution>
                        <phase>clean</phase>
                        <configuration>
                            <tasks>
                                <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
    
                                <if>
                                    <available file="d:\file_to_check.txt"/>
                                    <then>
                                        <echo>The file exists</echo>
                                    </then>
    
                                    <else>
                                        <echo>The file does not exist</echo>
                                    </else>
                                </if>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>ant-contrib</groupId>
                        <artifactId>ant-contrib</artifactId>
                        <version>20020829</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
    

    You can also view this link: How to execute tasks conditionally using the maven-antrun-plugin?

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

Sidebar

Related Questions

I want to read log4j.xml file which is outside the jar inside etc folder.
I want to add a GirdView inside a ListView ? Is it possible ?
In my SWT Java app I often want to return information from inside a
Can I put java code inside the .jrxml? For example, I want to put
I am not understanding how to add a webpage inside the tabbed panel so
I'd like to have some kind of file browser like Windows Explorer inside a
I have multiple .java files inside a folder (e.g temp/code/project) I want a batch
I want to use R inside my Java application. I now there is some
I want to display a silverlight web page inside my java desktop application. Does
I have workspace inside of Eclipse which has 2 projects in it. I want

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.