Topics

gfv5 window 10 build fails with latest maven and jdk 8


Gary Bello
 

mvn version 3.5.2
jdk 1.8.0_152

problem is at line 216 in
C:\Sun\hk2Git\hk2\maven-plugins\hk2-inhabitant-generator\src\main\java\org\jvnet\hk2\generator\internal\GeneratorRunner.java 
on my system.
For some reason the 'default' file cannot be deleted.

snippet:
                    if (!outputFile.delete()) {
                        throw new IOException("Could not delete existing inhabitant file " +
                                outputFile.getAbsolutePath() + " in the noSwap case");

I have debug stepped thru code to where exception is thrown and cannot delete the file from windows either,
windows says JVM has the file open.

Did not experience this issue a few weeks ago - maybe almost 2 months ?

The error happens in the maven plugin, when building the glassfish project,
Glassfish Nucleus HK2 Modules


Could not delete existing inhabitant file C:\Sun\glassfishGit\glassfish\nucleus\hk2\hk2-config\target\classes\META-INF\hk2-locator\default in the noSwap case
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Glassfish Nucleus HK2 Modules ...................... SUCCESS [  5.132 s]
[INFO] HK2 configuration module ........................... FAILURE [ 13.951 s]
[INFO] HK2 configuration reader generator module .......... SKIPPED
[INFO] HK2 config types ................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30.775 s
[INFO] Finished at: 2017-12-22T20:06:13-08:00
[INFO] Final Memory: 19M/135M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.glassfish.hk2:hk2-inhabitant-generator:2.5.0-b57:generate-inhabitants (generate-inhabitants) on project hk2-config: Could not generate inhabitants file for C:\Sun\glassfishGit\glassfish\nucleus\hk2\hk2-config\target\classes -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.glassfish.hk2:hk2-inhabitant-generator:2.5.0-b57:generate-inhabitants (generate-inhabitants) on project hk2-config: Could not generate inhabitants file for C:\Sun\glassfishGit\glassfish\nucleus\hk2\hk2-config\target\classes
 




Bill Shannon
 

I had a similar failure a few months ago that was due to something changing in a way that Maven didn't cope with.  "mvn clean" after the git update didn't clean up everything because of how the pom.xml had changed.  I had to clean it up manually.  (Sorry, I don't remember the details.)  Try creating a clean repo and start from scratch and see if it builds.

Gary Bello wrote on 12/22/17 08:07 PM:

mvn version 3.5.2
jdk 1.8.0_152

problem is at line 216 in
C:\Sun\hk2Git\hk2\maven-plugins\hk2-inhabitant-generator\src\main\java\org\jvnet\hk2\generator\internal\GeneratorRunner.java 
on my system.
For some reason the 'default' file cannot be deleted.

snippet:
                    if (!outputFile.delete()) {
                        throw new IOException("Could not delete existing inhabitant file " +
                                outputFile.getAbsolutePath() + " in the noSwap case");

I have debug stepped thru code to where exception is thrown and cannot delete the file from windows either,
windows says JVM has the file open.

Did not experience this issue a few weeks ago - maybe almost 2 months ?

The error happens in the maven plugin, when building the glassfish project,
Glassfish Nucleus HK2 Modules


Could not delete existing inhabitant file C:\Sun\glassfishGit\glassfish\nucleus\hk2\hk2-config\target\classes\META-INF\hk2-locator\default in the noSwap case
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Glassfish Nucleus HK2 Modules ...................... SUCCESS [  5.132 s]
[INFO] HK2 configuration module ........................... FAILURE [ 13.951 s]
[INFO] HK2 configuration reader generator module .......... SKIPPED
[INFO] HK2 config types ................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30.775 s
[INFO] Finished at: 2017-12-22T20:06:13-08:00
[INFO] Final Memory: 19M/135M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.glassfish.hk2:hk2-inhabitant-generator:2.5.0-b57:generate-inhabitants (generate-inhabitants) on project hk2-config: Could not generate inhabitants file for C:\Sun\glassfishGit\glassfish\nucleus\hk2\hk2-config\target\classes -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.glassfish.hk2:hk2-inhabitant-generator:2.5.0-b57:generate-inhabitants (generate-inhabitants) on project hk2-config: Could not generate inhabitants file for C:\Sun\glassfishGit\glassfish\nucleus\hk2\hk2-config\target\classes
 





Gary Bello
 

I did a fresh git pull of the Glassfish repo.
Then did a clean; Then a build.;
I get the same build error.

FYI - as prev mentioned - when I debug stepped thru the maven and plugin sources a month ago while building,
The 'default' file in windows is already open and cannot be deleted.
I also ran a maven build attempt form command line - to make sure Netbeans did not have the file open,
and same problem.

I have not yet attempted to figure out where the file gets opened and why it is not closed before it
is to be re-created. I know in Unix systems you can delete a file that is still open, but not windows.

-Gary


On Fri, Jan 12, 2018 at 3:52 PM, Bill Shannon <bill.shannon@...> wrote:
I had a similar failure a few months ago that was due to something changing in a way that Maven didn't cope with.  "mvn clean" after the git update didn't clean up everything because of how the pom.xml had changed.  I had to clean it up manually.  (Sorry, I don't remember the details.)  Try creating a clean repo and start from scratch and see if it builds.

Gary Bello wrote on 12/22/17 08:07 PM:
mvn version 3.5.2
jdk 1.8.0_152

problem is at line 216 in
C:\Sun\hk2Git\hk2\maven-plugins\hk2-inhabitant-generator\src\main\java\org\jvnet\hk2\generator\internal\GeneratorRunner.java 
on my system.
For some reason the 'default' file cannot be deleted.

snippet:
                    if (!outputFile.delete()) {
                        throw new IOException("Could not delete existing inhabitant file " +
                                outputFile.getAbsolutePath() + " in the noSwap case");

I have debug stepped thru code to where exception is thrown and cannot delete the file from windows either,
windows says JVM has the file open.

Did not experience this issue a few weeks ago - maybe almost 2 months ?

The error happens in the maven plugin, when building the glassfish project,
Glassfish Nucleus HK2 Modules


Could not delete existing inhabitant file C:\Sun\glassfishGit\glassfish\nucleus\hk2\hk2-config\target\classes\META-INF\hk2-locator\default in the noSwap case
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Glassfish Nucleus HK2 Modules ...................... SUCCESS [  5.132 s]
[INFO] HK2 configuration module ........................... FAILURE [ 13.951 s]
[INFO] HK2 configuration reader generator module .......... SKIPPED
[INFO] HK2 config types ................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30.775 s
[INFO] Finished at: 2017-12-22T20:06:13-08:00
[INFO] Final Memory: 19M/135M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.glassfish.hk2:hk2-inhabitant-generator:2.5.0-b57:generate-inhabitants (generate-inhabitants) on project hk2-config: Could not generate inhabitants file for C:\Sun\glassfishGit\glassfish\nucleus\hk2\hk2-config\target\classes -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.glassfish.hk2:hk2-inhabitant-generator:2.5.0-b57:generate-inhabitants (generate-inhabitants) on project hk2-config: Could not generate inhabitants file for C:\Sun\glassfishGit\glassfish\nucleus\hk2\hk2-config\target\classes
 






Gary Bello
 

This is an update of the below previous post in Dec/2017.

Glassfish still does not build on windows 10 64 bit with java 8 and maven 3.5.2.

This afternoon I determined the reason and a fix.

The reason the default file cannot be deleted is that it is open in windows.
file: glassfish\nucleus\hk2\hk2-config\target\classes\META-INF\hk2-locator\default 
It gets opened in the command-security-maven-plugin project code,

The file I changed is command-security-maven-plugin\src\main\java\org\glassfish\module\maven\commandsecurityplugin\TypeProcessorImpl.java .
The method is : private List<Inhabitant> findInhabitantsInModule(final BufferedReader br) throws IOException is passed the BufferedReader br
that has the file open. When the method returns the file is still open. I determined it was safe to call br.close(); before the return of the method,
and after adding the br.close call I can now successfully build Glassfish.
snippet:
        }
        br.close(); //newly added
        return result;
  } // last line of method

I needed to change the POM in nucleus-parent to use my locally built modified  command-security-maven-plugin project.
changes were:
        <!--<command-security-plugin.version>1.0.8</command-security-plugin.version>-->
        <command-security-plugin.version>1.0.9-SNAPSHOT</command-security-plugin.version>
 
My call hierarchy examination of that method only shows being called from 2 places and the BufferedReader is never used in the methods after the call to the modified method.

I do not have pull request create permissions and others should review my suggested change.
The change is in the maven plugin code that is used in the build of Glassfish.

Thanks
-Gary

---------- Forwarded message ----------
From: Gary Bello <gary.bello@...>
Date: Fri, Dec 22, 2017 at 8:07 PM
Subject: [glassfish] gfv5 window 10 build fails with latest maven and jdk 8
To: glassfish@javaee.groups.io


mvn version 3.5.2
jdk 1.8.0_152

problem is at line 216 in
C:\Sun\hk2Git\hk2\maven-plugins\hk2-inhabitant-generator\src\main\java\org\jvnet\hk2\generator\internal\GeneratorRunner.java 
on my system.
For some reason the 'default' file cannot be deleted.

snippet:
                    if (!outputFile.delete()) {
                        throw new IOException("Could not delete existing inhabitant file " +
                                outputFile.getAbsolutePath() + " in the noSwap case");

I have debug stepped thru code to where exception is thrown and cannot delete the file from windows either,
windows says JVM has the file open.

Did not experience this issue a few weeks ago - maybe almost 2 months ?

The error happens in the maven plugin, when building the glassfish project,
Glassfish Nucleus HK2 Modules


Could not delete existing inhabitant file C:\Sun\glassfishGit\glassfish\nucleus\hk2\hk2-config\target\classes\META-INF\hk2-locator\default in the noSwap case
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Glassfish Nucleus HK2 Modules ...................... SUCCESS [  5.132 s]
[INFO] HK2 configuration module ........................... FAILURE [ 13.951 s]
[INFO] HK2 configuration reader generator module .......... SKIPPED
[INFO] HK2 config types ................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30.775 s
[INFO] Finished at: 2017-12-22T20:06:13-08:00
[INFO] Final Memory: 19M/135M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.glassfish.hk2:hk2-inhabitant-generator:2.5.0-b57:generate-inhabitants (generate-inhabitants) on project hk2-config: Could not generate inhabitants file for C:\Sun\glassfishGit\glassfish\nucleus\hk2\hk2-config\target\classes -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.glassfish.hk2:hk2-inhabitant-generator:2.5.0-b57:generate-inhabitants (generate-inhabitants) on project hk2-config: Could not generate inhabitants file for C:\Sun\glassfishGit\glassfish\nucleus\hk2\hk2-config\target\classes