'Maven error when doing packaging

I am facing issues while trying to execute package goal in POM.xml file for my Maven application. I am getting below error while trying to package to jar file

Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor (default-descriptor) on project codesign-maven-plugin: Error extracting plugin descriptor: 'Goal: version already exists in the plugin descriptor for prefix: getversion
[ERROR] Existing implementation is: com.ios.plugin.VersionMojo
[ERROR] Conflicting implementation is: com.ios.plugin.VersionMojo'

My project is checked out from version controlled system and there are some versioned controlled file in my project, it seems they are getting included during execution

Here are my POM.xml file

<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 http://maven.apache.org/maven-v4_0_0.xsd">
    <parent>
        <groupId>com.ios.ccss</groupId>
        <artifactId>ios-client</artifactId>
        <version>3.0-Beta</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>ios-maven-plugin</artifactId>
    <packaging>maven-plugin</packaging>
    <name>ios-maven-plugin</name>
    <dependencies>
        <dependency>
            <groupId>com.ios.ccss</groupId>
            <artifactId>ios-lib</artifactId>
            <version>3.0-Beta</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>2.0</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
                <executions>
                    <execution>
                        <id>default-descriptor</id>
                        <goals>
                            <goal>descriptor</goal>
                        </goals>
                        <phase>process-classes</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <packagingExcludes>**/.ade_path/**</packagingExcludes>
                    <excludes>
                        <exclude>**/.ade_path/**</exclude>
                    </excludes>
                    <testExcludes>
                        <exclude>**/.ade_path/**</exclude>
                    </testExcludes>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                    </archive>
                    <appendAssemblyId>false</appendAssemblyId>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <!-- this is used for inheritance merges -->
                        <phase>package</phase>
                        <!-- bind to the packaging phase -->
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <finalName>ios-maven-plugin</finalName>
    </build>
</project>


Solution 1:[1]

Problem

Have just faced the same problem, after adding the @Mojo annotation to the MyMojo (a class derived from the AbstractMojo class).

The problematic part of the source code:

/**
 * Goal which touches a timestamp file.
 *
 * @goal touch
 *
 * @phase process-sources
 */
@Mojo(name = "touch", defaultPhase = LifecyclePhase.COMPILE)
public class MyMojo extends AbstractMojo {

Please, note both the Javadoc and the @Mojo annotation.

Solution

The solution is to remove the Javadoc for the MyMojo class and use only the @Mojo annotation.

The resulting source code:

@Mojo(name = "touch", defaultPhase = LifecyclePhase.COMPILE)
public class MyMojo extends AbstractMojo {

Source: jigger mast: Creating a maven plugin with java 5 annotations rather than javadoc tags.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sergey Vyacheslavovich Brunov