[ 
https://issues.apache.org/jira/browse/SUREFIRE-1431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17135140#comment-17135140
 ] 

Vincent Massol commented on SUREFIRE-1431:
------------------------------------------

Note: The following (which I find convoluted which is why I need to put so many 
comments to explain it in our pom.xml) but I hope that the fact that I define 
an empty argLine will not have side effects for some plugins:

{code}
...
<properties>
    <!-- The Surefire and Failsafe configurations override the <argLine> 
element using the @{argLine} notation which
         allows to include any argLine defined by plugins executing before them 
(such as Jacoco). However, if no such
         plugin executes before, the property is undefined and makes the tests 
fail. Thus we define an empty property
         here to make sure it doesn't fail. See also 
https://issues.apache.org/jira/browse/SUREFIRE-1431
    -->
    <argLine></argLine>
...
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
...
          <configuration>
...
            <!-- Explicitly define how much memory to give to the forked JVM 
process for the tests, as otherwise
                 Java will give about 1/4th of the physical memory which can be 
not enough or too much (e.g. on a CI
                 agent too much means we cannot run as many jobs in parallel as 
we could). -->
            <argLine>@{argLine} -Xmx1024m</argLine>
          </configuration>
{code}



> @{argLine} not replaced if undefined
> ------------------------------------
>
>                 Key: SUREFIRE-1431
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1431
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.21.1
>         Environment: Maven 3.5.0
>            Reporter: Matthieu Fillon
>            Assignee: Tibor Digana
>            Priority: Major
>         Attachments: maven.log
>
>
> I need to specify argLine for my tests. I also need it to work with Java 
> agent Jacoco when a certain Maven profile is activated.
> So I added `@{argLine}` to my argLine property and it works fine when running 
> with Jacoco agent activated.
> When running the tests without profile that activates Jacoco agent, the 
> surefire plugin fails with following line (relevant maven logs attached) :
> {color:red}Error: Could not find or load main class @\{argLine} {color}
> I guess @{argLine} is only replaced if an argLine has been defined before by 
> another plugin but if not it is not replaced at all.
> Should'nt it be replaced in any case and if none defined, just replace with 
> empty value?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to