Skip to content

[question] why are some plugins bound to the package phase executed by eclipse lifecycle mapping by default and others not? #1792

@reto-hoehener

Description

@reto-hoehener

In Eclipse 2024-06, new workspace, when I create a simple maven project with 2 plugins bound to the package phase, one is ignored and one is executed.

I thought Eclipse only considers phases up to and including compile as 'interesting', but I couldn't find any documentation about this, only hints here: https://eclipse.dev/m2e/documentation/m2e-execution-not-covered.html

I had a look inside the maven-dependency-plugin jar but did not observe any META-INF/m2e lifecycle mapping that could explain the execution. I clearly observe the junit dependency being copied to target/dependency by the Eclipse workspace build (no manual maven execution).

Is the maven-dependency-plugin treated special by m2e?

<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>test</groupId>
  <artifactId>test</artifactId>
  <version>1.0.0</version>
  <packaging>jar</packaging>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <build>
    <plugins>
      <plugin>

        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>3.1.0</version>
        <executions>
          <execution>
            <id>id</id>
            <phase>package</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <echo>Hello world!</echo>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>3.7.1</version>
        <executions>
          <execution>
            <id>id</id>
            <phase>package</phase>
            <goals>
              <goal>copy</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <artifactItems>
            <artifact>
              <groupId>junit</groupId>
              <artifactId>junit</artifactId>
              <version>4.11</version>
            </artifact>
          </artifactItems>
        </configuration>
      </plugin>

    </plugins>
  </build>
</project>

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions