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

Robert Scholte commented on MSCRIPTING-11:
------------------------------------------

I think in both cases the answer is execution-blocks
For 1: you want a script that looks like: 
{code:java}
if ("compile".equals(phase)) { /* do this*/ } else if 
("test-compile".equals(phase)) { /* do that*/ }
{code}
If that is the case, you'd better do this:

{code:xml}
        <build>
          <plugins>
            <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-scripting-plugin</artifactId>
          <version>3.0.0</version>
          <executions>
            <execution>
              <id>compile-script</id>
              <phase>compile</phase>
              <configuration>
                <script><![CDATA[ // I'm in the compile phase' ]]></script>
              </configuration>
            </execution>
            <execution>
              <id>test-compile-script</id>
              <phase>test-compile</phase>
              <configuration>
                <script><![CDATA[ // I'm in the test-compile phase' ]]></script>
              </configuration>
            </execution>
          </executions>
        </plugin>
          </plugins>
        </build>
{code}

for 2: I would make a profile called "setup", and have a couple of execution 
blocks using install:install-file

> Lifecycle
> ---------
>
>                 Key: MSCRIPTING-11
>                 URL: https://issues.apache.org/jira/browse/MSCRIPTING-11
>             Project: Maven Scripting
>          Issue Type: Improvement
>    Affects Versions: 3.0.0
>            Reporter: Hüseyin Kartal
>            Priority: Major
>              Labels: features, pull-request-available
>
> Make the current maven lifecycle phase available in the groovy script.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to