maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pete de Zwart (JIRA)" <j...@codehaus.org>
Subject [jira] Created: (MNG-4202) Unable to resolve ${env.HOSTNAME}
Date Tue, 16 Jun 2009 09:09:15 GMT
Unable to resolve ${env.HOSTNAME}
---------------------------------

                 Key: MNG-4202
                 URL: http://jira.codehaus.org/browse/MNG-4202
             Project: Maven 2
          Issue Type: Bug
    Affects Versions: 2.1.0, 2.0.10, 2.0.9
         Environment: Mac OS X _Leopard_ 10.5.7 with JDK 1.5.0_16
CentOS 5.2 with JDK 1.5.0_17 & 1.6.0_12
            Reporter: Pete de Zwart
            Priority: Critical


Empirical test. Using the following POM, you will be able to resolve the environment variable
{{$FOO}}:

{noformat}
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>test</groupId>
    <artifactId>test</artifactId>
    <packaging>pom</packaging>
    <version>1.1-SNAPSHOT</version>

    <modules>
	<module>${env.FOO}</module>
    </modules>
</project>
{noformat}

If we then assign the value {{BAR}} to {{$FOO}}, we can observer that the environment has
been set in the shell:

{noformat}
pdzwart@Fosters:/tmp[18:57:46](1,0)$ export FOO=BAR
pdzwart@Fosters:/tmp[18:58:48](1,0)$ echo $FOO
BAR
{noformat}

Now, running {{mvn clean}} using this POM, we expect that an exception will be thrown regarding
{{$PWD/BAR}} not existing:

{noformat}
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: unknown

Reason: Could not find the model file '/private/tmp/BAR'. for project unknown


[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Could not find the model file '/private/tmp/BAR'.
for project unknown
	at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:432)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:300)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
	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:585)
	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.project.ProjectBuildingException: Could not find the model file
'/private/tmp/BAR'. for project unknown
	at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1585)
	at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:506)
	at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:200)
	at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:632)
	at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:515)
	at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:588)
	at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:419)
	... 11 more
Caused by: java.io.FileNotFoundException: /private/tmp/BAR (No such file or directory)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at hidden.org.codehaus.plexus.util.xml.XmlReader.<init>(XmlReader.java:124)
	at hidden.org.codehaus.plexus.util.xml.XmlStreamReader.<init>(XmlStreamReader.java:67)
	at hidden.org.codehaus.plexus.util.ReaderFactory.newXmlReader(ReaderFactory.java:113)
	at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1580)
	... 17 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Tue Jun 16 18:59:37 EST 2009
[INFO] Final Memory: 1M/3M
[INFO] ------------------------------------------------------------------------
{noformat}

Excellent. Now, try this with {{$env.HOSTNAME}}, here is the POM:

{noformat}
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>test</groupId>
    <artifactId>test</artifactId>
    <packaging>pom</packaging>
    <version>1.1-SNAPSHOT</version>

    <modules>
	<module>${env.HOSTNAME}</module>
    </modules>
</project>
{noformat}

Here is what is currently assigned to {{$HOSTNAME}}:

{noformat}
pdzwart@Fosters:/tmp[19:00:10](1,0)$ echo $HOSTNAME
Fosters.sydney.atlassian.com
{noformat}

No, run maven again, and we expect that the directory {{$PWD/Fosters.sydney.atlassian.com}}
does not exist:

{noformat}
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: unknown

Reason: Could not find the model file '/private/tmp/${env.HOSTNAME}'. for project unknown


[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Could not find the model file '/private/tmp/${env.HOSTNAME}'.
for project unknown
	at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:432)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:300)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
	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:585)
	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.project.ProjectBuildingException: Could not find the model file
'/private/tmp/${env.HOSTNAME}'. for project unknown
	at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1585)
	at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:506)
	at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:200)
	at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:632)
	at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:515)
	at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:588)
	at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:419)
	... 11 more
Caused by: java.io.FileNotFoundException: /private/tmp/${env.HOSTNAME} (No such file or directory)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at hidden.org.codehaus.plexus.util.xml.XmlReader.<init>(XmlReader.java:124)
	at hidden.org.codehaus.plexus.util.xml.XmlStreamReader.<init>(XmlStreamReader.java:67)
	at hidden.org.codehaus.plexus.util.ReaderFactory.newXmlReader(ReaderFactory.java:113)
	at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1580)
	... 17 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Tue Jun 16 19:01:25 EST 2009
[INFO] Final Memory: 1M/3M
[INFO] ------------------------------------------------------------------------
{noformat}

OOOOKKKAAAAY..... let's take a closer look at that shall we:

{noformat}
Reason: Could not find the model file '/private/tmp/${env.HOSTNAME}'. for project unknown
{noformat}

And closer:

{noformat}
'/private/tmp/${env.HOSTNAME}'
{noformat}

Some extra special magic is going on there; I suspect that this specific environment variable
is being filtered out for some reason. So, let's try the following:
* {{${env.HOSTNAM}}}
{noformat}
 pdzwart@Fosters:/tmp[19:06:53](1,146)$ cat pom.xml && HOSTNAM=$HOSTNAME mvn clean
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>test</groupId>
    <artifactId>test</artifactId>
    <packaging>pom</packaging>
    <version>1.1-SNAPSHOT</version>

    <modules>
	<module>${env.HOSTNAM}</module>
    </modules>
</project>
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: unknown

Reason: Could not find the model file '/private/tmp/Fosters.sydney.atlassian.com'. for project
unknown
...
{noformat}
* {{${env.HOSTNAMEE}}}
{noformat}
pdzwart@Fosters:/tmp[19:07:31](1,146)$ cat pom.xml && HOSTNAMEE=$HOSTNAME mvn clean
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>test</groupId>
    <artifactId>test</artifactId>
    <packaging>pom</packaging>
    <version>1.1-SNAPSHOT</version>

    <modules>
	<module>${env.HOSTNAMEE}</module>
    </modules>
</project>
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: unknown

Reason: Could not find the model file '/private/tmp/Fosters.sydney.atlassian.com'. for project
unknown
...
{noformat}
* {{${env.HOSTNAMO}}}
{noformat}
pdzwart@Fosters:/tmp[19:07:59](1,146)$ cat pom.xml && HOSTNAMO=$HOSTNAME mvn clean
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>test</groupId>
    <artifactId>test</artifactId>
    <packaging>pom</packaging>
    <version>1.1-SNAPSHOT</version>

    <modules>
	<module>${env.HOSTNAMO}</module>
    </modules>
</project>
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: unknown

Reason: Could not find the model file '/private/tmp/Fosters.sydney.atlassian.com'. for project
unknown
{noformat}

Thanks for coming in today maven.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message