Description
The ArchiveMojo.execute() of the karaf-maven-plugin does
org.apache.maven.artifact.Artifact artifact = project.getArtifact(); artifact.setFile(targetFile);
where
@Parameter(defaultValue="${project.artifactId}-${project.version}") private File targetFile;
When using 'karaf-assembly'-packaging setFile() is called again with a correct value, but otherwise (eg packaging 'pom') this results in Artifact.GetFile() returning a non-existing File.
Afaik there is little value in calling Setfile() with an unexisting File.
For us this led to the following problem when using the maven-build-cache-extension
[INFO] Saved Build to local file: C:\path\local\buildinfo.xml [ERROR] Failed to save project, cleaning cache. Project: MavenProject: groupId:artifactId:version @ C:\path\pom.xml java.nio.file.NoSuchFileException: C:\path\artifactId-version at sun.nio.fs.WindowsException.translateToIOException (WindowsException.java:85) at sun.nio.fs.WindowsException.rethrowAsIOException (WindowsException.java:103) at sun.nio.fs.WindowsException.rethrowAsIOException (WindowsException.java:108) at sun.nio.fs.WindowsFileCopy.copy (WindowsFileCopy.java:98) at sun.nio.fs.WindowsFileSystemProvider.copy (WindowsFileSystemProvider.java:283) at java.nio.file.Files.copy (Files.java:1295) at org.apache.maven.buildcache.LocalCacheRepositoryImpl.saveArtifactFile (LocalCacheRepositoryImpl.java:357) at org.apache.maven.buildcache.CacheControllerImpl.save (CacheControllerImpl.java:461) at org.apache.maven.buildcache.BuildCacheMojosExecutionStrategy.execute (BuildCacheMojosExecutionStrategy.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:910) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283) at org.apache.maven.cli.MavenCli.main (MavenCli.java:206) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)