Artifact has not been packaged yet

There is a solution similar to s1moner3d answer which doesn't require changes to pom.xml file.

Go to Window > Preferences > Maven > Lifecycle Mappings and click on the Open workspace lifecycle mappings metadata button. screenshot

Than add pluginExecution entry like in the code below. If the file is empty, copy the entire content below. You might need to change versionRange.

<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
  <pluginExecutions>
    <pluginExecution>
      <pluginExecutionFilter>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <versionRange>2.10</versionRange>
        <goals>
          <goal>copy-dependencies</goal>
        </goals>
      </pluginExecutionFilter>
      <action>
        <ignore />
      </action>
    </pluginExecution>
  </pluginExecutions>
</lifecycleMappingMetadata>

In order for this to take effect go back to Preferences and click Reload workspace lifecycle mappings metadata. Update Maven projects and / or rebuild. The error should be gone.

Useful if you cannot or don't want to modify pom.xml for any reasons but want to stop your Eclipse m2e from executing particular goal of a particular plugin.


I solved by setting the plugin phase to prepare-package. I know it's still a workaround, but I think it's cleaner than compile externally.

<plugins>
        [...]
        <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        [YOUR_CONFIGURATION]
                    </configuration>
                </execution>
            </executions>
        </plugin>
        [...]
    </plugins>

EDIT:

This is not fully solving: sometimes it works, other times not.

The final solution is to use the Lifecycle Mapping Maven Dummy Plugin through an eclipse-only maven profile:

 <profile>
     <id>only-eclipse</id>
     <activation>
        <property>
         <name>m2e.version</name>
        </property>
     </activation>
     <build>
      <pluginManagement>
       <plugins>
         <plugin>
            <groupId>org.eclipse.m2e</groupId>
            <artifactId>lifecycle-mapping</artifactId>
            <version>1.0.0</version>
            <configuration>
                <lifecycleMappingMetadata>
                    <pluginExecutions>
                        <pluginExecution>
                            <pluginExecutionFilter>
                               <groupId>org.apache.maven.plugins</groupId>
                               <artifactId>maven-dependency-plugin</artifactId>
                               <versionRange>${maven-dependency-plugin.version}</versionRange>
                               <goals>
                                   <goal>copy-dependencies</goal>
                               </goals>
                            </pluginExecutionFilter>
                            <action>
                              <ignore />
                            </action>
                        </pluginExecution>
                    </pluginExecutions>
                </lifecycleMappingMetadata>
            </configuration>
        </plugin>
       </plugins>
      </pluginManagement>
     </build>
 </profile>

I got the same error and I solved this issue with a workaround. I have compiled and installed the project with Maven in a console outside Eclipse IDE. After I have refreshed the project inside Eclipse IDE and error has disappeared.


I had to wrap plugins tag under pluginManagement to make the error go away.

<pluginManagement>
        <plugins>
            <plugin>
               <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>../../lib/</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>false</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
</pluginManagement>

Tags:

Eclipse

Maven