NutzCN Logo
问答 nutzboot-maven-plugin shade失败
发布于 2373天前 作者 Marveliu 3278 次浏览 复制 上一个帖子 下一个帖子
标签:

环境
- Apache Maven 3.5.3
- nutzboot-maven-plugin:2.2-SNAPSHOT:shade
日志

[ERROR] The project main artifact does not exist. This could have the following
[ERROR] reasons:
[ERROR] - You have invoked the goal directly from the command line. This is not
[ERROR]   supported. Please add the goal to the default lifecycle via an
[ERROR]   <execution> element in your POM and use "mvn package" to have it run.
[ERROR] - You have bound the goal to a lifecycle phase before "package". Please
[ERROR]   remove this binding from your POM such that the goal will be run in
[ERROR]   the proper phase.
[ERROR] - You removed the configuration of the maven-jar-plugin that produces the main artifact.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.438 s
[INFO] Finished at: 2018-05-18T13:33:26+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.nutz.boot:nutzboot-maven-plugin:2.2-SNAPSHOT:shade (default-cli) on project gyb-nb-service-msg: Failed to create shaded artifact, project main artifact does not exist. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.nutz.boot:nutzboot-maven-plugin:2.2-SNAPSHOT:shade (default-cli) on project gyb-nb-service-msg: Failed to create shaded artifact, project main artifact does not exist.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to create shaded artifact, project main artifact does not exist.
    at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute (ShadeMojo.java:400)
    at org.nutz.boot.maven.NbShadeMojo.execute (NbShadeMojo.java:110)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

日志显示找不到main artifact,是找不到MainClass吗?
可是目录结构满足插件的要求:
package com.marveliu.app.sys.commons.core

@IocBean(create = "init", depose = "depose")
@Modules(packages = "com.marveliu")
public class DubboRpcSysMainLauncher {
    private static final Log log = Logs.get();

    @Inject
    private Dao dao;

    @Inject
    private Globals globals;//注入一下为了初始化

    public static void main(String[] args) throws Exception {
        NbApp nb = new NbApp().setArgs(args).setPrintProcDoc(true);
        nb.getAppContext().setMainPackage("com.marveliu");
        nb.run();
    }
....
5 回复

打包哪一个maven module?

噢,要先执行clean和package哦

然后才是shade

貌似没有用..

macdeMacBook-Pro:gyb-nb-service-sys Marveliu$ mvn clean package -DskipTests
[INFO] Scanning for projects...
[INFO] 
[INFO] ----------------< com.marveliu.app:gyb-nb-service-sys >-----------------
[INFO] Building gyb-nb-service-sys 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz/1.r.66-SNAPSHOT/maven-metadata.xml
Downloaded from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz/1.r.66-SNAPSHOT/maven-metadata.xml (1.2 kB at 1.9 kB/s)
Downloading from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-integration-rabbitmq/1.r.66-SNAPSHOT/maven-metadata.xml
Downloaded from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-integration-rabbitmq/1.r.66-SNAPSHOT/maven-metadata.xml (984 B at 1.3 kB/s)
Downloading from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzmore/1.r.66-SNAPSHOT/maven-metadata.xml
Downloaded from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzmore/1.r.66-SNAPSHOT/maven-metadata.xml (576 B at 6.5 kB/s)
Downloading from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-integration-dubbo/1.r.66-SNAPSHOT/maven-metadata.xml
Downloaded from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-integration-dubbo/1.r.66-SNAPSHOT/maven-metadata.xml (981 B at 11 kB/s)
Downloading from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-plugins-daocache/1.r.66-SNAPSHOT/maven-metadata.xml
Downloaded from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-plugins-daocache/1.r.66-SNAPSHOT/maven-metadata.xml (980 B at 1.4 kB/s)
Downloading from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-integration-jedis/1.r.66-SNAPSHOT/maven-metadata.xml
Downloaded from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-integration-jedis/1.r.66-SNAPSHOT/maven-metadata.xml (981 B at 13 kB/s)
Downloading from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-plugins-wkcache/1.r.66-SNAPSHOT/maven-metadata.xml
Downloaded from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-plugins-wkcache/1.r.66-SNAPSHOT/maven-metadata.xml (979 B at 11 kB/s)
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ gyb-nb-service-sys ---
[INFO] Deleting /Users/mac/project/ProjectRepository/gyb/gyb-parent/gyb-app/gyb-nb-service-sys/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ gyb-nb-service-sys ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 7 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ gyb-nb-service-sys ---
[INFO] Compiling 15 source files to /Users/mac/project/ProjectRepository/gyb/gyb-parent/gyb-app/gyb-nb-service-sys/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ gyb-nb-service-sys ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/mac/project/ProjectRepository/gyb/gyb-parent/gyb-app/gyb-nb-service-sys/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ gyb-nb-service-sys ---
[INFO] Compiling 1 source file to /Users/mac/project/ProjectRepository/gyb/gyb-parent/gyb-app/gyb-nb-service-sys/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ gyb-nb-service-sys ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ gyb-nb-service-sys ---
[INFO] Building jar: /Users/mac/project/ProjectRepository/gyb/gyb-parent/gyb-app/gyb-nb-service-sys/target/gyb-nb-service-sys-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.477 s
[INFO] Finished at: 2018-05-18T14:09:15+08:00
[INFO] ------------------------------------------------------------------------
macdeMacBook-Pro:gyb-nb-service-sys Marveliu$ mvn nutzboot:shade
[INFO] Scanning for projects...
Downloading from nutz-snapshots: http://jfrog.nutz.cn/artifactory/snapshots/org/nutz/boot/nutzboot-maven-plugin/2.2-SNAPSHOT/maven-metadata.xml
Downloaded from nutz-snapshots: http://jfrog.nutz.cn/artifactory/snapshots/org/nutz/boot/nutzboot-maven-plugin/2.2-SNAPSHOT/maven-metadata.xml (973 B at 3.8 kB/s)
[INFO] 
[INFO] ----------------< com.marveliu.app:gyb-nb-service-sys >-----------------
[INFO] Building gyb-nb-service-sys 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz/1.r.66-SNAPSHOT/maven-metadata.xml
Downloaded from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz/1.r.66-SNAPSHOT/maven-metadata.xml (1.2 kB at 2.5 kB/s)
Downloading from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-integration-rabbitmq/1.r.66-SNAPSHOT/maven-metadata.xml
Downloaded from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-integration-rabbitmq/1.r.66-SNAPSHOT/maven-metadata.xml (984 B at 11 kB/s)
Downloading from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzmore/1.r.66-SNAPSHOT/maven-metadata.xml
Downloaded from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzmore/1.r.66-SNAPSHOT/maven-metadata.xml (576 B at 6.1 kB/s)
Downloading from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-integration-dubbo/1.r.66-SNAPSHOT/maven-metadata.xml
Downloaded from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-integration-dubbo/1.r.66-SNAPSHOT/maven-metadata.xml (981 B at 12 kB/s)
Downloading from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-plugins-daocache/1.r.66-SNAPSHOT/maven-metadata.xml
Downloaded from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-plugins-daocache/1.r.66-SNAPSHOT/maven-metadata.xml (980 B at 13 kB/s)
Downloading from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-integration-jedis/1.r.66-SNAPSHOT/maven-metadata.xml
Downloaded from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-integration-jedis/1.r.66-SNAPSHOT/maven-metadata.xml (981 B at 10 kB/s)
Downloading from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-plugins-wkcache/1.r.66-SNAPSHOT/maven-metadata.xml
Downloaded from nutz-snapshots: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz-plugins-wkcache/1.r.66-SNAPSHOT/maven-metadata.xml (979 B at 12 kB/s)
[INFO] 
[INFO] --- nutzboot-maven-plugin:2.2-SNAPSHOT:shade (default-cli) @ gyb-nb-service-sys ---
Downloading from nutz-snapshots: http://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzboot-core/2.2-SNAPSHOT/maven-metadata.xml
Downloaded from nutz-snapshots: http://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzboot-core/2.2-SNAPSHOT/maven-metadata.xml (1.2 kB at 18 kB/s)
Downloading from nutz-snapshots: http://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz/1.r.66-SNAPSHOT/maven-metadata.xml
Downloaded from nutz-snapshots: http://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutz/1.r.66-SNAPSHOT/maven-metadata.xml (1.2 kB at 17 kB/s)
[ERROR] The project main artifact does not exist. This could have the following
[ERROR] reasons:
[ERROR] - You have invoked the goal directly from the command line. This is not
[ERROR]   supported. Please add the goal to the default lifecycle via an
[ERROR]   <execution> element in your POM and use "mvn package" to have it run.
[ERROR] - You have bound the goal to a lifecycle phase before "package". Please
[ERROR]   remove this binding from your POM such that the goal will be run in
[ERROR]   the proper phase.
[ERROR] - You removed the configuration of the maven-jar-plugin that produces the main artifact.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.444 s
[INFO] Finished at: 2018-05-18T14:09:27+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.nutz.boot:nutzboot-maven-plugin:2.2-SNAPSHOT:shade (default-cli) on project gyb-nb-service-sys: Failed to create shaded artifact, project main artifact does not exist. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
macdeMacBook-Pro:gyb-nb-service-sys Marveliu$ 

贴一下pom

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerArgs>
                        <arg>-parameters</arg>
                    </compilerArgs>
                    <useIncrementalCompilation>false</useIncrementalCompilation>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.3</version>
                <configuration>
                    <additionalparam>-Xdoclint:none</additionalparam>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.nutz.boot</groupId>
                <artifactId>nutzboot-maven-plugin</artifactId>
                <version>${nutzboot.version}</version>
            </plugin>
        </plugins>
    </build>

modules和nutzwk5的modules基本一致,其他的modules都出现这样的问题...

直接一起执行貌似就好了:—
mvn clean package nutzboot:shade -DskipTests

添加回复
请先登陆
回到顶部