FYI

The Maven Plugin is one of our most critical tool offerings as it is the
primary solution for RHOAR and all things microservices.


---------- Forwarded message ----------
From: Roland Huss <[email protected]>
Date: Thu, Nov 30, 2017 at 6:19 AM
Subject: Re: [openshift-sme] Maven plugin fabric8 - fabric8:watch on
Windows - ERROR
To: Mattia Mascia <[email protected]>
Cc: openshift-sme <[email protected]>


Thanks Mattia for investigating this issue !

Actually the canonical repo is https://github.com/
fabric8io/fabric8-maven-plugin , it would be awesome if you open an issue
there.

I'm currently not directly connected to the fabric8-maven-plugin anymore,
but there are good guys behind this project now.

thanks ...
... roland

On Thu, Nov 30, 2017 at 11:53 AM Mattia Mascia <[email protected]> wrote:

> Hi guys,
>
> I found the reason why this happen and I will open an pull request on
> https://github.com/rhuss/fabric8-maven-plugin
>
> The issue is on the
> *io.fabric8.maven.generator.javaexec.FatJarDetector.java* on the *scan*
> method.
>
> It never closes the jar file once it read it.
>
> @@ -59,8 +59,7 @@
>              long maxSize = 0;
>              for (String jarOrWar : jarOrWars) {
>                  File archiveFile = new File(directory, jarOrWar);
> -                try {
> -                    JarFile archive = new JarFile(archiveFile);
> +                try (JarFile archive = new JarFile(archiveFile)){
>                      Manifest mf = archive.getManifest();
>                      Attributes mainAttributes = mf.getMainAttributes();
>                      if (mainAttributes != null) {
>
>
> Best
>
> Mattia
>
> On Wed, Nov 29, 2017 at 10:37 AM, Mattia Mascia <[email protected]>
> wrote:
>
>> Hi SME,
>>
>> Anyone experience the following error using fabric8 plugin on Windows ?
>> Mac and Linux works fine.
>>
>> It looks like a race condition on the target jar and the mvn process is
>> the only one is try to access no other external processes are touching the
>> jar.
>>
>> [ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:3.5.33:build
>> (default) on project app-sample: Execution default of goal
>> io.fabric8:fabric8-maven-plugin:3.5.33:build failed: Cannot extract
>> generator config: org.apache.maven.plugin.MojoExecutionException: Failed
>> to add devtools files to fat jar 
>> C:\tmp\jenkins-cicd\target\app-sample-1.0-SNAPSHOT.jar.
>> java.io.IOException: Failed to delete original file
>> 'C:\tmp\jenkins-cicd\target\app-sample-1.0-SNAPSHOT.jar' after copy to
>> 'C:\TEMP\p251228\app-sample-1.0-SNAPSHOT.jar6705264538840591172.tmp' ->
>> [Help 1]
>>
>> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
>> execute goal io.fabric8:fabric8-maven-plugin:3.5.33:build (default) on
>> project app-sample: Execution default of goal 
>> io.fabric8:fabric8-maven-plugin:3.5.33:build
>> failed: Cannot extract generator config: 
>> org.apache.maven.plugin.MojoExecutionException:
>> Failed to add devtools files to fat jar 
>> C:\tmp\jenkins-cicd\target\app-sample-1.0-SNAPSHOT.jar.
>> java.io.IOException: Failed to delete original file
>> 'C:\tmp\jenkins-cicd\target\app-sample-1.0-SNAPSHOT.jar' after copy to
>> 'C:\TEMP\p251228\app-sample-1.0-SNAPSHOT.jar6705264538840591172.tmp'
>>
>>         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
>> MojoExecutor.java:224)
>>
>>         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
>> MojoExecutor.java:153)
>>
>>         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
>> MojoExecutor.java:145)
>>
>>         at org.apache.maven.lifecycle.internal.MojoExecutor.
>> executeForkedExecutions(MojoExecutor.java:364)
>>
>>         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
>> MojoExecutor.java:198)
>>
>>         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
>> MojoExecutor.java:153)
>>
>>         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
>> MojoExecutor.java:145)
>>
>>         at org.apache.maven.lifecycle.internal.MojoExecutor.
>> executeForkedExecutions(MojoExecutor.java:364)
>>
>>         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
>> MojoExecutor.java:198)
>>
>>         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
>> MojoExecutor.java:153)
>>
>>         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
>> MojoExecutor.java:145)
>>
>>         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.
>> buildProject(LifecycleModuleBuilder.java:108)
>>
>>         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.
>> buildProject(LifecycleModuleBuilder.java:76)
>>
>>         at org.apache.maven.lifecycle.internal.builder.singlethreaded.
>> SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
>>
>>         at org.apache.maven.lifecycle.internal.LifecycleStarter.
>> execute(LifecycleStarter.java:116)
>>
>>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
>>
>>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
>>
>>         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
>>
>>         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
>>
>>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
>>
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>
>>         at sun.reflect.NativeMethodAccessorImpl.invoke(
>> NativeMethodAccessorImpl.java:62)
>>
>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>> DelegatingMethodAccessorImpl.java:43)
>>
>>         at java.lang.reflect.Method.invoke(Method.java:498)
>>
>>         at org.codehaus.plexus.classworlds.launcher.Launcher.
>> launchEnhanced(Launcher.java:289)
>>
>>         at org.codehaus.plexus.classworlds.launcher.Launcher.
>> launch(Launcher.java:229)
>>
>>         at org.codehaus.plexus.classworlds.launcher.Launcher.
>> mainWithExitCode(Launcher.java:415)
>>
>>         at org.codehaus.plexus.classworlds.launcher.Launcher.
>> main(Launcher.java:356)
>>
>> Caused by: org.apache.maven.plugin.PluginExecutionException: Execution
>> default of goal io.fabric8:fabric8-maven-plugin:3.5.33:build failed:
>> Cannot extract generator config: 
>> org.apache.maven.plugin.MojoExecutionException:
>> Failed to add devtools files to fat jar 
>> C:\tmp\jenkins-cicd\target\app-sample-1.0-SNAPSHOT.jar.
>> java.io.IOException: Failed to delete original file
>> 'C:\tmp\jenkins-cicd\target\app-sample-1.0-SNAPSHOT.jar' after copy to
>> 'C:\TEMP\p251228\app-sample-1.0-SNAPSHOT.jar6705264538840591172.tmp'
>>
>>         at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(
>> DefaultBuildPluginManager.java:144)
>>
>>         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
>> MojoExecutor.java:208)
>>
>>         ... 27 more
>>
>> Caused by: java.lang.IllegalArgumentException: Cannot extract generator
>> config: org.apache.maven.plugin.MojoExecutionException: Failed to add
>> devtools files to fat jar 
>> C:\tmp\jenkins-cicd\target\app-sample-1.0-SNAPSHOT.jar.
>> java.io.IOException: Failed to delete original file
>> 'C:\tmp\jenkins-cicd\target\app-sample-1.0-SNAPSHOT.jar' after copy to
>> 'C:\TEMP\p251228\app-sample-1.0-SNAPSHOT.jar6705264538840591172.tmp'
>>
>>         at io.fabric8.maven.plugin.mojo.build.BuildMojo.
>> customizeConfig(BuildMojo.java:297)
>>
>>         at io.fabric8.maven.docker.config.ConfigHelper.
>> resolveImages(ConfigHelper.java:51)
>>
>>         at io.fabric8.maven.docker.AbstractDockerMojo.
>> initImageConfiguration(AbstractDockerMojo.java:308)
>>
>>         at io.fabric8.maven.docker.AbstractDockerMojo.execute(
>> AbstractDockerMojo.java:215)
>>
>>         at io.fabric8.maven.plugin.mojo.build.BuildMojo.execute(
>> BuildMojo.java:193)
>>
>>         at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(
>> DefaultBuildPluginManager.java:133)
>>
>>         ... 28 more
>>
>> Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to add
>> devtools files to fat jar 
>> C:\tmp\jenkins-cicd\target\app-sample-1.0-SNAPSHOT.jar.
>> java.io.IOException: Failed to delete original file
>> 'C:\tmp\jenkins-cicd\target\app-sample-1.0-SNAPSHOT.jar' after copy to
>> 'C:\TEMP\p251228\app-sample-1.0-SNAPSHOT.jar6705264538840591172.tmp'
>>
>>         at io.fabric8.maven.generator.springboot.SpringBootGenerator.ad
>> dDevToolsFilesToFatJar(SpringBootGenerator.java:151)
>>
>>         at io.fabric8.maven.generator.springboot.
>> SpringBootGenerator.customize(SpringBootGenerator.java:86)
>>
>>         at io.fabric8.maven.plugin.generator.GeneratorManager.
>> generate(GeneratorManager.java:62)
>>
>>         at io.fabric8.maven.plugin.mojo.build.BuildMojo.
>> customizeConfig(BuildMojo.java:295)
>>
>>         ... 33 more
>>
>> Caused by: java.io.IOException: Failed to delete original file
>> 'C:\tmp\jenkins-cicd\target\app-sample-1.0-SNAPSHOT.jar' after copy to
>> 'C:\TEMP\p251228\app-sample-1.0-SNAPSHOT.jar6705264538840591172.tmp'
>>
>>         at org.apache.commons.io.FileUtils.moveFile(FileUtils.java:2578)
>>
>>         at io.fabric8.maven.generator.springboot.SpringBootGenerator.co
>> pyFilesToFatJar(SpringBootGenerator.java:169)
>>
>>         at io.fabric8.maven.generator.springboot.SpringBootGenerator.ad
>> dDevToolsFilesToFatJar(SpringBootGenerator.java:149)
>>
>> Few questions:
>>
>>    - Is  https://github.com/rhuss/fabric8-maven-plugin the right place
>>    to open the issue ?
>>    - Who support the plugin and do we have dedicate team here?
>>
>> Thanks a lot
>>
>> Mattia
>>
>> --
>>
>> MATTIA MASCIA
>>
>> SENIOR CONSULTANT
>>
>> Red Hat Switzerland <https://www.redhat.com/en/global/switzerland>
>>
>> [email protected]    M: +41 79 41 14 377 <+41794114377>
>> <https://red.ht/sig>
>>
>
>
>
> --
>
> MATTIA MASCIA
>
> SENIOR CONSULTANT
>
> Red Hat Switzerland <https://www.redhat.com/en/global/switzerland>
>
> [email protected]    M: +41 79 41 14 377 <+41794114377>
> <https://red.ht/sig>
> Have a question?
> First, check the FAQ: https://pnt.redhat.com/pnt/p-
> 734673/openshift-con...-Jun-2017.pdf
> Next, check the archives: http://post-office.corp.
> redhat.com/archives/openshift-sme/


Have a question?
First, check the FAQ: https://pnt.redhat.com/pnt/p-
734673/openshift-con...-Jun-2017.pdf
Next, check the archives: http://post-office.corp.
redhat.com/archives/openshift-sme/
_______________________________________________
Devtools mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/devtools

Reply via email to