We discuss this issue in Slack
We know for certain that there is a problem with environment variables.
So there must be a bug in our code then. I have analysed the code I think
the problem should be with spaces in the value of environment variable
MAVEN_OPTS. There is no quotation marks around such environemnt variable
when we have such rough element in String[] when we call
Runtime.execute(cli, String[]).

Here is the list of comments from Slack and the way how we got there:

the `forkMode=auto` in profile `embedded` so it's okay. But I analyzed
`MavenITmng4747JavaAgentUsedByPluginTest` and Line  53 `newVerifier(
testDir.getAbsolutePath() )` and I got to `CommandLine` class from
`maven-shared-utils:0.9`. Although forking is used if we use env vars in
the IT but I got to `execute()` method and I was interested in `String[]
environment = getEnvironmentVariables();` which finally is passed to Java
running forked process. Please tell me if this code is okay for you:
    ```public String[] getEnvironmentVariables()
    {
        addSystemEnvironment();
        String[] environmentVars = new String[envVars.size()];
        int i = 0;
        for ( String name : envVars.keySet() )
        {
            String value = envVars.get( name );
            environmentVars[i] = name + "=" + value;
            i++;
        }
        return environmentVars;
    }```
I do not see quotation marks. This is important if you use two or more
systm properties in `MAVEN_OPTS=-Dk1=v1 -Dk2=v2` - there is a space!
Next issue is that the env vars of the parent process are merged with given
vars for the child process in `addSystemEnvironment();`, Line 239.

that's why maybe platform Linux does not understand the space and maybe
Windows does not have a problem with it.

merging env vars is strange because of JAVA_HOME, there are at least two.
One in CLI and second in env vars.

I think we should use latest `maven-shared-utils` and check the code in
shared utils. Maybe to fix shared utils and meanwhile use snapshot version,
maybe.




On Tue, Jul 16, 2019 at 11:22 PM Tibor Digana <tibordig...@apache.org>
wrote:

> Heads up!,
>
> I am investigating the build errors on Maven Core.
> So I created three branches moved the HEAD backwards (i.e. git reset
> --hard HEAD~12) and observed the outcome.
>
> I have investigated 29 commits. Not sure how far to go...
>
> `maven-resolver-1.3.3-reset-head-12` crashed with Linux + JDK 7, 8, 11, 12
> (16 ITs)
> `maven-resolver-1.3.3-reset-head-14` crashed with Linux + JDK 7 and 8 (8
> ITs)
> `maven-resolver-1.3.3-reset-head-29` crashed Linux JDK 8 (4 ITs)
>
> Always the ITs 0553, 4590, 4747 fail on several nodes.
> Always related to Linux.
>
> See the list of errors and branches:
>
>
> https://builds.apache.org/job/maven-box/job/maven/job/maven-resolver-1.3.3-reset-head-12/1/#showFailuresLink
>
> https://builds.apache.org/job/maven-box/job/maven/job/maven-resolver-1.3.3-reset-head-14/1/
>
> https://builds.apache.org/job/maven-box/job/maven/job/maven-resolver-1.3.3-reset-head-29/1/
>
>
>
> From the MavenITmng0553SettingsAuthzEncryptionTest:
>
> [ERROR] Error executing Maven.
> org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException:
> java.io.FileNotFoundException: /home/jenkins/.m2/settings-security.xml (No
> such file or directory)
>     at org.sonatype.plexus.components.sec.dispatcher.SecUtil.read
> (SecUtil.java:69)
>     at org.apache.maven.cli.MavenCli.encryption (MavenCli.java:920)
>     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:286)
>     at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
>
> [ERROR] Failed to execute goal on project test: Could not resolve 
> dependencies for project org.apache.maven.its.mng0553:test:jar:1.0-SNAPSHOT: 
> Failed to collect dependencies at 
> org.apache.maven.its.mng0553:a:jar:0.1-SNAPSHOT: Failed to read artifact 
> descriptor for org.apache.maven.its.mng0553:a:jar:0.1-SNAPSHOT: Could not 
> transfer artifact org.apache.maven.its.mng0553:a:pom:0.1-SNAPSHOT from/to 
> test (http://localhost:32917/): Not authorized
>
>
>
> From the MavenITmng4590ImportedPomUsesSystemPropertiesTest:
>
> expected:</home/jenkins/jenkins-slave/workspace/ven-resolver-1.3.3-reset-head-29/test/core-it-suite/target/test-classes/mng-4590/pom.xml>
>  but 
> was:</home/jenkins/jenkins-slave/workspace/ven-resolver-1.3.3-reset-head-29/test/core-it-suite/target/test-classes/mng-4590/${test.file}>
>
>
>
> From the MavenITmng4747JavaAgentUsedByPluginTest:
>
> junit.framework.AssertionFailedError
>       at 
> org.apache.maven.it.MavenITmng4747JavaAgentUsedByPluginTest.testit(MavenITmng4747JavaAgentUsedByPluginTest.java:63)
>
>

Reply via email to