[
https://issues.apache.org/jira/browse/MNG-5219?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Michael Osipov closed MNG-5219.
-------------------------------
Resolution: Cannot Reproduce
Fix Version/s: (was: 3.x / Backlog)
Cannot reproduce with 3.6.2-SNAPSHOT:
{noformat}
[DEBUG] (f) packaging = pom
[DEBUG] (f) pomFile = C:\Users\mosipov\Downloads\pom.xml
[DEBUG] (s) skip = false
[DEBUG] (f) updateReleaseInfo = false
[DEBUG] -- end configuration --
[INFO] Installing C:\Users\mosipov\Downloads\pom.xml to
C:\Users\mosipov\.m2\repository\test\mvn\install\test-mvn-install\1-SNAPSHOT\test-mvn-install-1-SNAPSHOT.pom
[DEBUG] Writing tracking file
C:\Users\mosipov\.m2\repository\test\mvn\install\test-mvn-install\1-SNAPSHOT\_remote.repositories
[DEBUG] Installing
test.mvn.install:test-mvn-install:1-SNAPSHOT/maven-metadata.xml to
C:\Users\mosipov\.m2\repository\test\mvn\install\test-mvn-install\1-SNAPSHOT\maven-metadata-local.xml
[DEBUG] Installing test.mvn.install:test-mvn-install/maven-metadata.xml to
C:\Users\mosipov\.m2\repository\test\mvn\install\test-mvn-install\maven-metadata-local.xml
[INFO] Installing C:\Users\mosipov\Downloads\target\nonexistent.nonsense to
C:\Users\mosipov\.m2\repository\test\mvn\install\test-mvn-install\1-SNAPSHOT\test-mvn-install-1-SNAPSHOT.nonsense
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.970 s
[INFO] Finished at: 2019-07-24T23:10:09+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-install-plugin:2.4:install (default-install) on
project test-mvn-install: Failed to install artifact
test.mvn.install:test-mvn-install:nonsense:1-SNAPSHOT:
C:\Users\mosipov\Downloads\target\nonexistent.nonsense (Das System kann den
angegebenen Pfad nicht finden) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal
org.apache.maven.plugins:maven-install-plugin:2.4:install (default-install) on
project test-mvn-install: Failed to install artifact
test.mvn.install:test-mvn-install:nonsense:1-SNAPSHOT:
C:\Users\mosipov\Downloads\target\nonexistent.nonsense (Das System kann den
angegebenen Pfad nicht finden)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute
(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute
(MojoExecutor.java:154)
{noformat}
> Regression from M2: Installing non-existing artifact is silently ignored
> ------------------------------------------------------------------------
>
> Key: MNG-5219
> URL: https://issues.apache.org/jira/browse/MNG-5219
> Project: Maven
> Issue Type: Bug
> Components: Artifacts and Repositories
> Affects Versions: 3.0.3, 3.0.4
> Environment: Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
> Maven home: /home/kozelka/opt/apache-maven-3.0.3
> Java version: 1.6.0_22, vendor: Sun Microsystems Inc.
> Default locale: en_US, platform encoding: ANSI_X3.4-1968
> OS name: "linux", version: "2.6.38-13-generic", arch: "amd64", family: "unix"
> Reporter: Petr Kozelka
> Assignee: Jason van Zyl
> Priority: Major
> Attachments: MNG-fail-install-ifnotfound.patch, pom.xml
>
>
> Maven 2.2.1 used to fail during "install" phase when an attached artifact did
> not exist.
> This is no longer true with version 3.0.3.
> To reproduce the bug, store attached pom.xml into an empty directory and try:
> a) maven 2.2.1 - use command "mvn clean install -e" to see the stacktrace:
> {noformat}
> [INFO] [install:install {execution: default-install}]
> [INFO] Installing /TESTDIR/pom.xml to
> /LOCALREPO/test/mvn/install/test-mvn-install/1-SNAPSHOT/test-mvn-install-1-SNAPSHOT.pom
> [INFO] Installing /TESTDIR/target/nonexistent.nonsense to
> /LOCALREPO/test/mvn/install/test-mvn-install/1-SNAPSHOT/test-mvn-install-1-SNAPSHOT.nonsense
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Error installing artifact: File /TESTDIR/target/nonexistent.nonsense
> does not exist
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Trace
> org.apache.maven.lifecycle.LifecycleExecutionException: Error installing
> artifact: File /TESTDIR/target/nonexistent.nonsense does not exist
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
> at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
> at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
> at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
> at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> Caused by: org.apache.maven.plugin.MojoExecutionException: Error installing
> artifact: File /TESTDIR/target/nonexistent.nonsense does not exist
> at
> org.apache.maven.plugin.install.InstallMojo.execute(InstallMojo.java:143)
> at
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
> ... 17 more
> Caused by: org.apache.maven.artifact.installer.ArtifactInstallationException:
> Error installing artifact: File /TESTDIR/target/nonexistent.nonsense does not
> exist
> at
> org.apache.maven.artifact.installer.DefaultArtifactInstaller.install(DefaultArtifactInstaller.java:119)
> at
> org.apache.maven.plugin.install.InstallMojo.execute(InstallMojo.java:133)
> ... 19 more
> Caused by: java.io.IOException: File /TESTDIR/target/nonexistent.nonsense
> does not exist
> at hidden.org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:1003)
> at
> org.apache.maven.artifact.installer.DefaultArtifactInstaller.install(DefaultArtifactInstaller.java:98)
> ... 20 more
> [INFO]
> ------------------------------------------------------------------------
> {noformat}
> Here, M2 fails, and gives nice explanatory message.
> b) maven 3.0.3 - use command "mvn clean install -X" to see the improper
> message from aether:
> {noformat}
> [DEBUG] Configuring mojo
> 'org.apache.maven.plugins:maven-install-plugin:2.3.1:install' with basic
> configurator -->
> [DEBUG] (f) artifact = test.mvn.install:test-mvn-install:pom:1-SNAPSHOT
> [DEBUG] (f) attachedArtifacts =
> [test.mvn.install:test-mvn-install:nonsense:1-SNAPSHOT]
> [DEBUG] (f) createChecksum = false
> [DEBUG] (f) localRepository = id: local
> url: file:///LOCALREPO/
> layout: none
> [DEBUG] (f) packaging = pom
> [DEBUG] (f) pomFile = /TESTDIR/pom.xml
> [DEBUG] (f) updateReleaseInfo = false
> [DEBUG] -- end configuration --
> [INFO] Installing /TESTDIR/pom.xml to
> /LOCALREPO/test/mvn/install/test-mvn-install/1-SNAPSHOT/test-mvn-install-1-SNAPSHOT.pom
> [DEBUG] Installing
> test.mvn.install:test-mvn-install:1-SNAPSHOT/maven-metadata.xml to
> /LOCALREPO/test/mvn/install/test-mvn-install/1-SNAPSHOT/maven-metadata-local.xml
> [DEBUG] Installing test.mvn.install:test-mvn-install/maven-metadata.xml to
> /LOCALREPO/test/mvn/install/test-mvn-install/maven-metadata-local.xml
> [INFO] Installing /TESTDIR/target/nonexistent.nonsense to
> /LOCALREPO/test/mvn/install/test-mvn-install/1-SNAPSHOT/test-mvn-install-1-SNAPSHOT.nonsense
> [DEBUG] Skipped re-installing /TESTDIR/target/nonexistent.nonsense to
> /LOCALREPO/test/mvn/install/test-mvn-install/1-SNAPSHOT/test-mvn-install-1-SNAPSHOT.nonsense,
> seems unchanged
> [DEBUG] Installing
> test.mvn.install:test-mvn-install:1-SNAPSHOT/maven-metadata.xml to
> /LOCALREPO/test/mvn/install/test-mvn-install/1-SNAPSHOT/maven-metadata-local.xml
> [DEBUG] Installing test.mvn.install:test-mvn-install/maven-metadata.xml to
> /LOCALREPO/test/mvn/install/test-mvn-install/maven-metadata-local.xml
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO]
> ------------------------------------------------------------------------
> {noformat}
> In this case, the problem is (almost silently) ignored, because M3 (aether)
> sees that the new file is the same as the old one _(correct :) - none of them
> exist)_, due to a [bug
> here|https://github.com/sonatype/sonatype-aether/blob/master/aether-impl/src/main/java/org/sonatype/aether/impl/internal/DefaultInstaller.java#L260].
> He simply believes that same timestamp on both sides means that the artifact
> does not need to be copied.
> This is true *except when the timestamp is -1* - indicating missing file.
> There are several ways to fix this:
> - in maven-3 code (attached patch does this)
> - in aether code
> - in both - which I believe is best
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)