• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Maven build failing - cannot clean

 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was debugging a piece of code. I didn’t have any POMs open, everything was going fine.
I tried to clean & build a project from within Netbeans it failed saying “ Failed to clean project: Failed to delete F:\Javadev\Parent\{modulename}\target\test-classes\.netbeans_automatic_build

Now it won’t clean or compile anything.

I have tried deleting the file myself, it makes no difference. No module will compile, all give the same error.
I have tried restarting the machine.

What have I done?

My Parent POM



My Assembly POM


My Central POM


I have removed the irrelevant modules from the POMs.

If I try 'mvn clean install' from a command line it says it compiles parent but then fails on Central with the same message.
 
Neil Barton
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
and then...just like that... it all started working again. I didn't edit anything, didn't change anything. Just rebuilt another module and everything now cleans and compiles. I just love Maven :-(
 
Marshal
Posts: 4519
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you have a terminal window open somewhere in or below the build target directory?

Did you have a process running which was using the built jar file?
 
Saloon Keeper
Posts: 15561
364
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Again, nothing to do with Maven. Maven can't help it if the file system blocks access to a file. This is usually the case when you have a terminal window open or a file is in active use.
 
Neil Barton
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ron, not as far as I know. As I said I rebooted the PC in the end and it was still doing it. One thing to throw in the mix: I have recently started using the Reflect library to get a value. That is mentioned in the output dump. The notes say not to use Reflect for a live system (but there's no alternative) could this be a symptom of Reflect not behaving itself?
 
Neil Barton
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry Marshal, How do I move it to another forum? I'm guessing Java General (is there a maven specific?). It's happening again so I need to work out what's causing it.
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Campbell already moved it for you.

I noticed that the path that failed had {modulename} in it. I couldn't find any references to it, but I'm guessing that was the issue. Given that the file was called .netbeans_automatic_build makes me think this may have been a glitch in Netbeans.
 
Neil Barton
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry Rob, that was me, I was trying to show that it didn't matter what module name was in there they all fail to compile with the same error message. I have tried : switching the PC off. Checking for locks. Upgrading Netbeans to V20. Still it persists, nothing compiles with this same error. I have tried deleting every file it says it can't delete only to get to the point where all folders under the target folder are deleted when it says it can't delete them (took a while), when even the target folder is removed it responds with:  Central: Error while storing the mojo status: F:\Javadev\Parent\Central\target\maven-status\maven-compiler-plugin\compile\default-compile\inputFiles.lst -> [Help 1]
 
Neil Barton
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just tried to create a new ANT project, it fails to create it and leaves me at the 'Create project' screen. There is no error message. If I try to create a maven project it fails again and leaves me on the same screen but this time it gives the error message "Called DataObject.find on null" I'm not sure how I get it working again! Any help appreciated.
 
Saloon Keeper
Posts: 27819
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since my command shell doesn't have "screens", I'll have to assume you're having a problem with an IDE. And I can't tell which IDE it was.

Note "mvn clean" normally just deletes the project's target directory and everything under it. Windows cannot delete directories that are currently serving as the current (working) directory for any command shell that might be running on the system because Windows locks based on the file path name. Unix-like systems lock on inodes not names, so you can delete in cases where Windows wouldn't let you, but you'll still probably wish you hadn't. So before doing a clean always make sure that you don't have any open connections to files or directories under /target.
 
Neil Barton
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim, Yes, I'm working with Netbeans IDE, and I think that was the culprit. Thinking back I remember using the Netbeans 'move' facility to move a project around. It seemed OK at the time but it was about an hour later that the problems started. I think it corrupted the file structure somehow. I tried everything, even changing the permissions to everyone full control but it made no difference. What I did was to export all of the modules out, create a new folder and import them back in (took a while). After a little tweaking all is now working again.
I may be a bit hesitant about using the Netbeans 'move' facility in future!
reply
    Bookmark Topic Watch Topic
  • New Topic