You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Herve Boutemy (Jira)" <ji...@apache.org> on 2020/04/22 06:34:00 UTC

[jira] [Commented] (MNG-5001) @readonly Mojo parameter annotation doesn't work

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

Herve Boutemy commented on MNG-5001:
------------------------------------

attached simpler test to easily do local tests, simply overriding "basedir" readonly parameter of maven-compiler-plugin
{code:xml}
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.5.1</version>
        <configuration>
          <basedir>trying-to-override-default-value-readonly</basedir>
        </configuration>
      </plugin>
{code}

run with Maven 2 cause:
{noformat}[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error configuring: org.apache.maven.plugins:maven-compiler-plugin. Reason: ERROR: Cannot override read-only parameter: basedir in goal: compiler:compile
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error configuring: org.apache.maven.plugins:maven-compiler-plugin. Reason: ERROR: Cannot override read-only parameter: basedir in goal: compiler:compile
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:723)
[...]{noformat}

> @readonly Mojo parameter annotation doesn't work
> ------------------------------------------------
>
>                 Key: MNG-5001
>                 URL: https://issues.apache.org/jira/browse/MNG-5001
>             Project: Maven
>          Issue Type: Bug
>          Components: Plugin API
>    Affects Versions: 3.0.2
>            Reporter: Jochen Ehret
>            Assignee: Sylwester Lachiewicz
>            Priority: Major
>             Fix For: 3.7.0-candidate
>
>         Attachments: log-maven-2.2.1.txt, log-maven-3.0.2.txt, pom.xml, readonlytest.zip
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> In Maven 2.2.1, the @readonly annotation works as described: You can't configure a Mojo parameter in the pom <configuration> section. If you do, the build will fail:
> {noformat}[INFO] Error configuring: test:test-plugin. Reason: ERROR: Cannot override read-only parameter: testParameter in goal: test:dumpParameter{noformat}
> In Maven 3.0.2, the @readonly seems to have no effect:
> {noformat}[INFO] --- test-plugin:0.0.1-SNAPSHOT:dumpParameter (test-exec) @ test-project ---
> testParameter: readonly parameter configured in pom{noformat}
> You can reproduce the behaviour with the attached example project. Log outputs for Maven 2.2.1 and 3.0.2 are also attached.



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