m2e shade eclipse “project main artifact does not exist”

后端 未结 2 1359
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-10 16:46

I\'m trying to make a deployment package that bundles all the dependencies of my maven module that has dependencies to another maven project in eclipse.

I have this in m

相关标签:
2条回答
  • 2021-02-10 17:04

    [ERROR] The project main artifact does not exist. This could have the following

    We were getting this problem recently. What resolved it for us was to not do mvn shade:shade but instead use:

    mvn package
    

    This does additional compilation and package work before running the shade plugin and so the main class was available on the classpath.

    0 讨论(0)
  • 2021-02-10 17:12

    The shade plugin is attempting to include the project's artifact in the shaded JAR. Since it doesn't exist (yet), you're getting this error. You either need to build/package the project artifact first (e.g., by attaching the shade goal to the package phase)

    If you don't have any project artifact to include in the shaded JAR, you can add an excludes node to remove the project's artifact.

    Here's an example:

    <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>1.6</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <transformers>
                            <transformer
                                implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>com.group.id.Launcher1</mainClass>
                            </transformer>
                        </transformers>
                        <excludes>
                            <exclude>com.my.proj:AAA</exclude>
                        </excludes>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    
    0 讨论(0)
提交回复
热议问题