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

[BUG, version 2.2]: FileNotFound exception when executing versions:set in child module #64

Closed
haakobja opened this issue Apr 6, 2016 · 3 comments
Milestone

Comments

@haakobja
Copy link

haakobja commented Apr 6, 2016

Version 2.2

I have a project with a child module. If I execute mvn versions:set -DnewVersion=<version> -DartifactId=<child> from the parent directory it works as expected, the child version gets updated. If I try to run mvn versions:set -DnewVersion=<version> from the child directory I get this exception:

[ERROR]
java.io.FileNotFoundException: C:\Workspace\ReleaseTest\child\child (Systemet finner ikke angitt fil)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at org.codehaus.plexus.util.xml.XmlReader.<init>(XmlReader.java:124)
        at org.codehaus.plexus.util.xml.XmlStreamReader.<init>(XmlStreamReader.java:67)
        at org.codehaus.plexus.util.ReaderFactory.newXmlReader(ReaderFactory.java:118)
        at org.codehaus.mojo.versions.api.PomHelper.readXmlFile(PomHelper.java:1613)
        at org.codehaus.mojo.versions.AbstractVersionsUpdaterMojo.process(AbstractVersionsUpdaterMojo.java:319)
        at org.codehaus.mojo.versions.SetMojo.execute(SetMojo.java:251)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        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:116)
        at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
        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:497)
        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)
[INFO] Processing no.haakonjahre:child
[INFO]     Updating project no.haakonjahre:child
[INFO]         from version 1.2 to 1.3

As you can see, it tries to check the child relative to itself, thus trying to access the child/childmodule.

This is the parent pom:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>no.haakonjahre</groupId>
    <artifactId>releasetest</artifactId>
    <version>1.1</version>
    <packaging>pom</packaging>

    <modules>
        <module>child</module>
    </modules>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <version>2.2</version>
            </plugin>
        </plugins>
    </build>
</project>

And this is the child pom:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <parent>
        <artifactId>releasetest</artifactId>
        <groupId>no.haakonjahre</groupId>
        <version>1.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <groupId>no.haakonjahre</groupId>
    <artifactId>child</artifactId>
    <version>1.3</version>
</project>
@khmarbaise
Copy link
Member

Can you make a test project on github and post the url so i can take a look..

@haakobja
Copy link
Author

haakobja commented Apr 7, 2016

Sure. I've added a test project here: https://github.com/haakobja/versions-maven-plugin-bug

Setting a new parent version works:

ReleaseTest> mvn versions:set -DnewVersion=1.3
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] releasetest
[INFO] child
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building releasetest 1.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.2:set (default-cli) @ releasetest ---
[INFO] Searching for local aggregator root...
[INFO] Local aggregation root: C:\Workspace\ReleaseTest
[INFO] Processing change of no.haakonjahre:releasetest:1.1 -> 1.3
[INFO] Processing no.haakonjahre:releasetest
[INFO]     Updating project no.haakonjahre:releasetest
[INFO]         from version 1.1 to 1.3
[INFO]
[INFO] Processing no.haakonjahre:child
[INFO]     Updating parent no.haakonjahre:releasetest
[INFO]         from version 1.1 to 1.3
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] releasetest ........................................ SUCCESS [  1.692 s]
[INFO] child .............................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.914 s
[INFO] Finished at: 2016-04-07T10:15:43+02:00
[INFO] Final Memory: 11M/241M
[INFO] ------------------------------------------------------------------------

Setting the child version from parent dir, works:

ReleaseTest> mvn versions:set -DnewVersion=1.2 -DartifactId=child
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] releasetest
[INFO] child
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building releasetest 1.3
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.2:set (default-cli) @ releasetest ---
[INFO] Searching for local aggregator root...
[INFO] Local aggregation root: C:\Workspace\ReleaseTest
[INFO] Processing change of no.haakonjahre:child:1.3 -> 1.2
[INFO] Processing no.haakonjahre:child
[INFO]     Updating project no.haakonjahre:child
[INFO]         from version 1.3 to 1.2
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] releasetest ........................................ SUCCESS [  1.314 s]
[INFO] child .............................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.506 s
[INFO] Finished at: 2016-04-07T10:15:57+02:00
[INFO] Final Memory: 11M/241M
[INFO] ------------------------------------------------------------------------

Changing to the child and running, throws an exception but works:

ReleaseTest> cd child/
R/child> mvn versions:set -DnewVersion=1.3
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building child 1.2
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.2:set (default-cli) @ child ---
[INFO] Searching for local aggregator root...
[INFO] Local aggregation root: C:\Workspace\ReleaseTest
[INFO] Processing change of no.haakonjahre:child:1.2 -> 1.3
[ERROR]
java.io.FileNotFoundException: C:\Workspace\ReleaseTest\child\child (Systemet finner ikke angitt fil)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at org.codehaus.plexus.util.xml.XmlReader.<init>(XmlReader.java:124)
        at org.codehaus.plexus.util.xml.XmlStreamReader.<init>(XmlStreamReader.java:67)
        at org.codehaus.plexus.util.ReaderFactory.newXmlReader(ReaderFactory.java:118)
        at org.codehaus.mojo.versions.api.PomHelper.readXmlFile(PomHelper.java:1613)
        at org.codehaus.mojo.versions.AbstractVersionsUpdaterMojo.process(AbstractVersionsUpdaterMojo.java:319)
        at org.codehaus.mojo.versions.SetMojo.execute(SetMojo.java:251)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        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:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
        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:497)
        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)
[INFO] Processing no.haakonjahre:child
[INFO]     Updating project no.haakonjahre:child
[INFO]         from version 1.2 to 1.3
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.506 s
[INFO] Finished at: 2016-04-07T10:18:23+02:00
[INFO] Final Memory: 11M/241M
[INFO] ------------------------------------------------------------------------

This exception should, in my opinion, not happen

@fabiojb
Copy link
Contributor

fabiojb commented Jun 27, 2016

Issue fixed with the commit eea2ebf.

@khmarbaise khmarbaise added this to the 2.3 milestone Jun 27, 2016
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

3 participants