Hi,

while i'm experimenting with LifeCycleParticipant i stumbled over a thing which looks like a bug for me or a regression...or i misunderstand a thing...

So the LifeCycle Participant is defined like this:

..
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
...
@Singleton
@Named
public class LifeCycleParticipant extends AbstractMavenLifecycleParticipant {
        private final Logger LOGGER = LoggerFactory.getLogger(getClass());
...
}
In the methods i have simply done a logging similar to the following:
                LOGGER.info("LifeCycleParticipant::LifeCycleParticipant(ctro) 
{}", this);


If i define the plugin which contains an implementation of LifeCycleParticipant like this:

<plugins>
    <plugin>
      <groupId>@project.groupId@</groupId>
      <artifactId>@project.artifactId@</artifactId>
        <version>@project.version@</version>
        <extensions>true</extensions>
        <configuration>
          <conf>ANTON</conf>
        </configuration>
        <executions>
        <execution>
        <id>first</id>
        <goals><goal>test</goal></goals>
        <phase>initialize</phase>
        </execution>
        </executions>
      </plugin>
    </plugins>

Furthermore i have defined in my test plugin like this:

@Mojo( name = "test", defaultPhase = LifecyclePhase.NONE, requiresProject = true, threadSafe = true )
public class TestMojo
    extends AbstractUpToDateMojo
{

        @Parameter
        private String conf;
        
        @Inject
        private LifeCycleParticipant deploy;
        

If take a look into the output during my integration test (running with Maven 3.2.5) i can see that the LifeCycle participant will be instantiated two times...(got two different adresses) which looks simply wrong to me, cause @Singleton means a single instance...


If i run the same part with Maven 3.3.1 i can see only a single instance of LifeCycleParticipant...as I expected...

So as far as i know JSR330 was supported starting with Maven 3.1.1 ...so i would expect that it works well in Maven 3.2.X which does not look like...at the moment...

So the question is: Is it not allowed to inject the life cycle participant into the plugin to make configuration possible ?

Any thoughts...

Kind regards
Karl Heinz Marbaise

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to