Maven 2 & 3

maven should execute compiler:compile and :test-compile in separate executions, to allow separate configuration

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0.7
  • Fix Version/s: 2.2.0
  • Component/s: Plugins and Lifecycle
  • Labels:
    None
  • Number of attachments :
    0

Description

Currently, it's impossible to configure the two default maven-compiler-plugin mojos in the jar lifecycle (:compile and :test-compile) separately without the configuration for one affecting both. This is because they are both executed in the same (default) execution. We should be assigning these to different execution id's, to allow separate configuration.

Issue Links

Activity

Hide
Brett Porter added a comment -

I'm not sure what you mean here - how would this be used? Maybe something like:

<configuration>
<shared>...</shared>
</configuration>
<executions>
<execution>
<id>testCompile</id>
<configuration>
<something>...
</configuration>
<!-- not goals, that's already bound -->
</execution>
</executions>

I'm not even sure that'd work - could be a good way to achieve this though. Would you implement it by putting every bound goal in it's own execution? Currently, there is no way to specify this in the default lifecycles.

Show
Brett Porter added a comment - I'm not sure what you mean here - how would this be used? Maybe something like: <configuration> <shared>...</shared> </configuration> <executions> <execution> <id>testCompile</id> <configuration> <something>... </configuration> <!-- not goals, that's already bound --> </execution> </executions> I'm not even sure that'd work - could be a good way to achieve this though. Would you implement it by putting every bound goal in it's own execution? Currently, there is no way to specify this in the default lifecycles.
Hide
Brian Fox added a comment -

bumping to 2.0.9. If we get IT tests for these before 2.0.8 is final, we can take a look

Show
Brian Fox added a comment - bumping to 2.0.9. If we get IT tests for these before 2.0.8 is final, we can take a look
Hide
John Casey added a comment -

Pushing to 2.0.11 so we can have a smaller set of high-value issues to target for the next release (2.0.10).

Show
John Casey added a comment - Pushing to 2.0.11 so we can have a smaller set of high-value issues to target for the next release (2.0.10).
Hide
John Casey added a comment -

for default lifecycle bindings (mojos bound to the lifecycle from the packaging of the POM), the executionId that can be used to configure each is 'default-<goalname>'. So, to configure the compiler plugin differently for the compile and testCompile goals, you'd use something like:

<plugin>
  <artifactId>maven-compiler-plugin</artifactId>
  <executions>
    <execution>
      <id>default-compile</id>
      <configuration>
        <source>1.4</source>
        <target>1.4</target>
      </configuration>
    </execution>
    <execution>
      <id>default-testCompile</id>
      <configuration>
        <source>1.5</source>
        <target>1.5</target>
      </configuration>
    </execution>
  </executions>
</plugin>

This should work both in Maven 2.2.0 and in Maven 3.x. See IT:

MavenITmng3203DefaultLifecycleExecIdTest.java

Show
John Casey added a comment - for default lifecycle bindings (mojos bound to the lifecycle from the packaging of the POM), the executionId that can be used to configure each is 'default-<goalname>'. So, to configure the compiler plugin differently for the compile and testCompile goals, you'd use something like:
<plugin>
  <artifactId>maven-compiler-plugin</artifactId>
  <executions>
    <execution>
      <id>default-compile</id>
      <configuration>
        <source>1.4</source>
        <target>1.4</target>
      </configuration>
    </execution>
    <execution>
      <id>default-testCompile</id>
      <configuration>
        <source>1.5</source>
        <target>1.5</target>
      </configuration>
    </execution>
  </executions>
</plugin>
This should work both in Maven 2.2.0 and in Maven 3.x. See IT: MavenITmng3203DefaultLifecycleExecIdTest.java

People

Vote (5)
Watch (5)

Dates

  • Created:
    Updated:
    Resolved: