This Question is Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
13 Replies Last post: Feb 15, 2010 12:32 PM by Sergey Anchipolevsky  
Scott MacDonald Newbie 69 posts since
Mar 17, 2006
Currently Being Moderated

Jan 27, 2010 6:56 PM

Additional Maven Command Line Parameters not working on a linux build agent

For our builds, we have a master maven plugin that does all our work.  We can turn on certain optional features by using -D parameters (ex. -DexecuteSonar).  For our builds working on windows build agents, this works great.  I can see the -D parameter being used in the build log, and the debug output statements in our plugin shows the value for the flag being true.

 

However on the linux agent, I do not see the -D parameter in the build log anywhere, and the plugin's debug output statement is informing us that it was not set.

 

Is there something I need to setup on the linux agent to get it to use the Additional Maven Command Line Parameters correctly?

 

-Scott

Sergey Anchipolevsky JetBrains 256 posts since
Jan 22, 2008
Currently Being Moderated
Jan 28, 2010 3:26 PM in response to: Scott MacDonald
Re: Additional Maven Command Line Parameters not working on a linux build agent

Could you please provide your additional command line parameters string and the build log.

 

You can try to workaround this by setting a system property in the build configuration settings.

Sergey Anchipolevsky JetBrains 256 posts since
Jan 22, 2008
Currently Being Moderated
Feb 10, 2010 10:00 AM in response to: Scott MacDonald
Re: Additional Maven Command Line Parameters not working on a linux build agent

My tests are showing system properties are passed correctly both on windows and linux.

To check this on your side please add the following snippet to your pom.xml

 

  <build>

...
    <plugins>
     <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
       <version>1.3</version>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <configuration>
              <tasks>
                <echo message="executeSonar = ${executeSonar}"/>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>

...
  </build>

 

and launch a build on your linux agent. It will print the value of your system property (which should be 'true').

 

Also, in your build log I've found the following text:

...

[13:23:29]: [INFO] ------------------------------------------------------------------------
[13:23:29]: [INFO] Building Monsanto Repliweb
[13:23:29]: [INFO]    task-segment: [com.monsanto.tps:masterbuild-maven-plugin:1.0.9-SNAPSHOT:selective-sonar] (aggregator-style)
[13:23:29]: [INFO] ------------------------------------------------------------------------
[13:23:31]: [INFO] [masterbuild:selective-sonar]
[13:23:31]: executeSonar = true
[13:23:31]: [INFO] Executing Maven command: mvn sonar:sonar
[13:23:32]: [INFO] Scanning for projects...

...

Doesn't this mean that your build has successfully detected the presence of your parameter?

Sergey Anchipolevsky JetBrains 256 posts since
Jan 22, 2008
Currently Being Moderated
Feb 11, 2010 1:03 PM in response to: Scott MacDonald
Re: Additional Maven Command Line Parameters not working on a linux build agent

Scott,

 

Could you please create a sample build configuration just with the pom I listed in the previous message, run a build on a linux agent and send me the build log.

 

Thank you.

 

Also, did you try the workaround with setting a system property instead of passing it via command line?

Sergey Anchipolevsky JetBrains 256 posts since
Jan 22, 2008
Currently Being Moderated
Feb 11, 2010 1:19 PM in response to: Scott MacDonald
Re: Additional Maven Command Line Parameters not working on a linux build agent

Also to make the experiment clean enough please change the name of the property to something neutral and unique, say "_prop_1" or alike.

Thank you.

Sergey Anchipolevsky JetBrains 256 posts since
Jan 22, 2008
Currently Being Moderated
Feb 12, 2010 4:46 PM in response to: Scott MacDonald
Re: Additional Maven Command Line Parameters not working on a linux build agent

I mean setting a system property not for the agent JVM, but in the build configuratio settings. See step 6 "Properties and environment variables".

Setting a property in there is essentially the same thing as setting it in the command line on the runner settings page.

 

Since I don't know how your plugin determines the command line parameters on the first level of maven execution, I can't figure out what goes wrong then on the second level on linux agents. Could please explain your build mechanism in a bit more detail?

Sergey Anchipolevsky JetBrains 256 posts since
Jan 22, 2008
Currently Being Moderated
Feb 15, 2010 12:32 PM in response to: Scott MacDonald
Re: Additional Maven Command Line Parameters not working on a linux build agent

OK. I see. Thank you for the clarification.

Sergey Anchipolevsky JetBrains 256 posts since
Jan 22, 2008
Currently Being Moderated
Feb 11, 2010 1:08 PM in response to: Scott MacDonald
Re: Additional Maven Command Line Parameters not working on a linux build agent

No. I don't see any problem with the profile

More Like This

  • Retrieving data ...