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

  • Home
  • SEARCH
  • 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 3698482
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:59:11+00:00 2026-05-19T04:59:11+00:00

I am wondering what the major difference between running mvn compile and mvn clean

  • 0

I am wondering what the major difference between running mvn compile and mvn clean compile are, in practicality.

I understand what the actual difference is, that mvn clean compile deletes all the generated files and starts again from scratch, but why would we want to do this? I can assume mvn compile will regenerate files if it’s necessary, right?

One thing I noticed in my project was that if you had deleted a source file, without running clean, the compiled file remains, which usually wouldn’t be a problem, but could be I suppose.

  • 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-19T04:59:12+00:00Added an answer on May 19, 2026 at 4:59 am

    As noted in Gareth’s answer, when you rename or remove a source class, Maven doesn’t have sufficient information to know to remove the corresponding compiled file from the previous build. The presence of the stale file can cause unexpected runtime problems. A clean is required to get rid of the stale files so that they doesn’t get accidentally included in WARs, JARs and so on.

    In addition, certain plugins require a clean in order to work properly. For example (at least in Maven 2), the maven-war-plugin explodes each dependent WAR into an existing directory tree. A clean is required to get rid of stale files left over from previous versions of the dependent WARs.

    I can assume "mvn compile" will regenerate files if it’s necessary, right?

    For mainstream plugins, that is a fair assumption. However, if you are using a plugin to generate source code components, I’d look carefully at the documentation, and at where you put the generated source code. For instance, there are a couple of unsupported plugins whose purpose is to drive the Eclipse EMF code generator.

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

Sidebar

Related Questions

wondering what is the major difference between these two: onClick and mouseClick..
So I was wondering if there are any major differences between the various implementations
Wondering if this is possible. We have an 3rd Party library that contains identification
I have a blog where the front end works fine in all major browsers
What is the difference between using top and left properties and top and left
Just wondering if anyone could give me a comparison of trade-offs between these modules
I have a server program (works on all three major os systems), created in
After much googling I have been wondering what the benefits/differences are between mysql and
I'm wondering whether major SQL engines out there (MS SQL, Oracle, MySQL) have the
I am writing a C program that is expected to be compiled with all

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.