Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not delete existing inhabitant file #379

Open
glassfishrobot opened this issue Jan 20, 2018 · 1 comment
Open

Could not delete existing inhabitant file #379

glassfishrobot opened this issue Jan 20, 2018 · 1 comment

Comments

@glassfishrobot
Copy link

Cloned glassfish this week and ran into the following error during mvn install

HK2 configuration module - FAILURE
hk2-inhabitant-generator:2.5.0-b57:generate-inhabitants
Could not delete existing inhabitant file C:\GitRepository\glassfish5\nucleus\hk2\hk2-config\target\class\META-INF\hk2-locator\default in the noSwap case

I had successfully executed "mvn install" (against glassfish) a few weeks prior; not sure what changed to have caused this error to surface.

Something screwy with the Java being unable to File.delete() within hk2-inhabitant-generator ... Creating a local version of hk2-inhabitant-generator which doesn't throw the IOException allows maven to limp along.

org.jvnet.hk2.generator.internal.GeneratorRunner.writeToDirectory()

            File noSwapFile = null;
            boolean directWrite = false;
            if (noSwap || !outputFile.exists()) {
                directWrite = true;
                if (outputFile.exists()) {
                    if (!outputFile.delete()) {
                        // swallow the error to allow maven to limp along
                        // throw new IOException("Could not delete existing inhabitant file " +
                        //        outputFile.getAbsolutePath() + " in the noSwap case");
                    	System.out.println("Could not delete existing inhabitant file " +
                                        outputFile.getAbsolutePath() + " in the noSwap case");
                    }
                }

Fails on both swap/noswap variant.

There have been prior Issues (i.e dc33a5f, 8b04e7b) related to Windows holding a lock on the File, and Java not being able to successfully delete()... typically resolved by judicious use of close(). Have seen other cases (at work) where delete() works fine on Linux but not Windows.

It seems like hk2-inhabitant-generator has already been fixed to work on Windows. Anyone know why I am now experiencing the issue?

@glassfishrobot
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant