NutzCN Logo
问答 NB2.2-SNAPSHOT打包失败,找不到starter的Jar包
发布于 2520天前 作者 elkan1788 2953 次浏览 复制 上一个帖子 下一个帖子
标签:

参考官方文档写了个NB的简单的示例项目,结果在用Maven打包时出现以下错误:

INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building nb-demo 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzboot-starter/2.2-SNAPSHOT/maven-metadata.xml
Downloading: http://nexus.office.sao.so/nexus/content/groups/public/org/nutz/nutzboot-starter/2.2-SNAPSHOT/maven-metadata.xml
Downloading: https://jfrog.nutz.cn/artifactory/jcenter/org/nutz/nutzboot-starter/2.2-SNAPSHOT/maven-metadata.xml
Downloading: http://nexus.office.sao.so/nexus/content/repositories/snapshots/org/nutz/nutzboot-starter/2.2-SNAPSHOT/maven-metadata.xml
Downloaded: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzboot-starter/2.2-SNAPSHOT/maven-metadata.xml (576 B at 977 B/s)
Downloading: http://nexus.office.sao.so/nexus/content/groups/public/org/nutz/nutzboot-parent/2.2-SNAPSHOT/maven-metadata.xml
Downloading: https://jfrog.nutz.cn/artifactory/jcenter/org/nutz/nutzboot-parent/2.2-SNAPSHOT/maven-metadata.xml
Downloading: http://nexus.office.sao.so/nexus/content/repositories/snapshots/org/nutz/nutzboot-parent/2.2-SNAPSHOT/maven-metadata.xml
Downloading: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzboot-parent/2.2-SNAPSHOT/maven-metadata.xml
Downloaded: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzboot-parent/2.2-SNAPSHOT/maven-metadata.xml (575 B at 7.3 kB/s)
Downloading: http://nexus.office.sao.so/nexus/content/repositories/snapshots/org/nutz/nutzboot-core/2.2-SNAPSHOT/maven-metadata.xml
Downloading: https://jfrog.nutz.cn/artifactory/jcenter/org/nutz/nutzboot-core/2.2-SNAPSHOT/maven-metadata.xml
Downloading: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzboot-core/2.2-SNAPSHOT/maven-metadata.xml
Downloading: http://nexus.office.sao.so/nexus/content/groups/public/org/nutz/nutzboot-core/2.2-SNAPSHOT/maven-metadata.xml
Downloaded: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzboot-core/2.2-SNAPSHOT/maven-metadata.xml (1.2 kB at 8.5 kB/s)
Downloading: http://nexus.office.sao.so/nexus/content/groups/public/org/nutz/nutzboot-starter-jetty/2.2-SNAPSHOT/maven-metadata.xml
Downloading: https://jfrog.nutz.cn/artifactory/jcenter/org/nutz/nutzboot-starter-jetty/2.2-SNAPSHOT/maven-metadata.xml
Downloading: http://nexus.office.sao.so/nexus/content/repositories/snapshots/org/nutz/nutzboot-starter-jetty/2.2-SNAPSHOT/maven-metadata.xml
Downloading: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzboot-starter-jetty/2.2-SNAPSHOT/maven-metadata.xml
Downloaded: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzboot-starter-jetty/2.2-SNAPSHOT/maven-metadata.xml (1.2 kB at 16 kB/s)
Downloading: http://nexus.office.sao.so/nexus/content/repositories/snapshots/org/nutz/nutzboot-starter-nutz-mvc/2.2-SNAPSHOT/maven-metadata.xml
Downloading: http://nexus.office.sao.so/nexus/content/groups/public/org/nutz/nutzboot-starter-nutz-mvc/2.2-SNAPSHOT/maven-metadata.xml
Downloading: https://jfrog.nutz.cn/artifactory/jcenter/org/nutz/nutzboot-starter-nutz-mvc/2.2-SNAPSHOT/maven-metadata.xml
Downloading: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzboot-starter-nutz-mvc/2.2-SNAPSHOT/maven-metadata.xml
Downloaded: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzboot-starter-nutz-mvc/2.2-SNAPSHOT/maven-metadata.xml (1.2 kB at 9.4 kB/s)
Downloading: http://nexus.office.sao.so/nexus/content/groups/public/org/nutz/nutzboot-starter-nutz-dao/2.2-SNAPSHOT/maven-metadata.xml
Downloading: https://jfrog.nutz.cn/artifactory/jcenter/org/nutz/nutzboot-starter-nutz-dao/2.2-SNAPSHOT/maven-metadata.xml
Downloading: http://nexus.office.sao.so/nexus/content/repositories/snapshots/org/nutz/nutzboot-starter-nutz-dao/2.2-SNAPSHOT/maven-metadata.xml
Downloading: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzboot-starter-nutz-dao/2.2-SNAPSHOT/maven-metadata.xml
Downloaded: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzboot-starter-nutz-dao/2.2-SNAPSHOT/maven-metadata.xml (1.2 kB at 8.8 kB/s)
Downloading: http://nexus.office.sao.so/nexus/content/repositories/snapshots/org/nutz/nutzboot-starter-jdbc/2.2-SNAPSHOT/maven-metadata.xml
Downloading: http://nexus.office.sao.so/nexus/content/groups/public/org/nutz/nutzboot-starter-jdbc/2.2-SNAPSHOT/maven-metadata.xml
Downloading: https://jfrog.nutz.cn/artifactory/jcenter/org/nutz/nutzboot-starter-jdbc/2.2-SNAPSHOT/maven-metadata.xml
Downloading: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzboot-starter-jdbc/2.2-SNAPSHOT/maven-metadata.xml
Downloaded: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzboot-starter-jdbc/2.2-SNAPSHOT/maven-metadata.xml (1.2 kB at 8.7 kB/s)
Downloading: http://nexus.office.sao.so/nexus/content/groups/public/org/nutz/nutzboot-starter-swagger/2.2-SNAPSHOT/maven-metadata.xml
Downloading: http://nexus.office.sao.so/nexus/content/repositories/snapshots/org/nutz/nutzboot-starter-swagger/2.2-SNAPSHOT/maven-metadata.xml
Downloading: https://jfrog.nutz.cn/artifactory/jcenter/org/nutz/nutzboot-starter-swagger/2.2-SNAPSHOT/maven-metadata.xml
Downloading: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzboot-starter-swagger/2.2-SNAPSHOT/maven-metadata.xml
Downloaded: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzboot-starter-swagger/2.2-SNAPSHOT/maven-metadata.xml (1.2 kB at 8.3 kB/s)
Downloading: http://nexus.office.sao.so/nexus/content/repositories/snapshots/org/nutz/nutzboot-starter/2.2-SNAPSHOT/nutzboot-starter-2.2-SNAPSHOT.jar
Downloading: http://nexus.office.sao.so/nexus/content/groups/public/org/nutz/nutzboot-starter/2.2-SNAPSHOT/nutzboot-starter-2.2-SNAPSHOT.jar
Downloading: https://jfrog.nutz.cn/artifactory/jcenter/org/nutz/nutzboot-starter/2.2-SNAPSHOT/nutzboot-starter-2.2-SNAPSHOT.jar
Downloading: https://jfrog.nutz.cn/artifactory/snapshots/org/nutz/nutzboot-starter/2.2-SNAPSHOT/nutzboot-starter-2.2-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.388 s
[INFO] Finished at: 2018-01-11T11:17:44+08:00
[INFO] Final Memory: 12M/136M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project nb-demo: Could not resolve dependencies for project io.github.elkan1788:nb-demo:jar:1.0.0-SNAPSHOT: Could not transfer artifact org.nutz:nutzboot-starter:jar:2.2-SNAPSHOT from/to nutz (https://jfrog.nutz.cn/artifactory/jcenter): Failed to transfer file: https://jfrog.nutz.cn/artifactory/jcenter/org/nutz/nutzboot-starter/2.2-SNAPSHOT/nutzboot-starter-2.2-SNAPSHOT.jar. Return code is: 409 , ReasonPhrase:Conflict. -> [Help 1]

409 是资源冲突了吗?

21 回复

看上去不是,我看看CI的情况

OK, 那吃好午饭再试试看,谢谢。

等等, 不需要加 nutzboot-starter 呢

去掉这个依赖项就好了

哦,去掉确实是没有这个错误,不过在shade打包时又出现个奇怪的错误:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.1.0:shade (default) on project nb-demo: Execution default of goal org.apache.maven.plugins:maven-shade-plugin:3.1.0:shade failed: A required class was missing while executing org.apache.maven.plugins:maven-shade-plugin:3.1.0:shade: org/jdom/Element
-----------------------------------------------------
realm =    plugin>org.apache.maven.plugins:maven-shade-plugin:3.1.0
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/apache/maven/plugins/maven-shade-plugin/3.1.0/maven-shade-plugin-3.1.0.jar
urls[1] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
urls[2] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
urls[3] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/apache/maven/maven-aether-provider/3.0/maven-aether-provider-3.0.jar
urls[4] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/sonatype/aether/aether-util/1.7/aether-util-1.7.jar
urls[5] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
urls[6] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/codehaus/plexus/plexus-component-annotations/1.6/plexus-component-annotations-1.6.jar
urls[7] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
urls[8] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
urls[9] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/codehaus/plexus/plexus-utils/3.0.24/plexus-utils-3.0.24.jar
urls[10] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/apache/maven/shared/maven-artifact-transfer/0.9.1/maven-artifact-transfer-0.9.1.jar
urls[11] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/apache/maven/shared/maven-common-artifact-filters/3.0.1/maven-common-artifact-filters-3.0.1.jar
urls[12] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/apache/maven/shared/maven-shared-utils/3.1.0/maven-shared-utils-3.1.0.jar
urls[13] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar
urls[14] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/ow2/asm/asm/6.0_BETA/asm-6.0_BETA.jar
urls[15] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/ow2/asm/asm-commons/6.0_BETA/asm-commons-6.0_BETA.jar
urls[16] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/ow2/asm/asm-tree/6.0_BETA/asm-tree-6.0_BETA.jar
urls[17] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/jdom/jdom/1.1.3/jdom-1.1.3.jar
urls[18] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.jar
urls[19] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
urls[20] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/commons-io/commons-io/2.5/commons-io-2.5.jar
urls[21] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/vafer/jdependency/1.2/jdependency-1.2.jar
urls[22] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/ow2/asm/asm-analysis/6.0_BETA/asm-analysis-6.0_BETA.jar
urls[23] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/org/ow2/asm/asm-util/6.0_BETA/asm-util-6.0_BETA.jar
urls[24] = file:/Users/senhui.li/DevelopSpaces/MavenRepository/com/google/guava/guava/19.0/guava-19.0.jar
Number of foreign imports: 1
import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

-----------------------------------------------------

	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:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
	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.PluginExecutionException: Execution default of goal org.apache.maven.plugins:maven-shade-plugin:3.1.0:shade failed: A required class was missing while executing org.apache.maven.plugins:maven-shade-plugin:3.1.0:shade: org/jdom/Element
-----------------------------------------------------

但在查询所有的依赖时,只找到过guava-20版本,这里边出来个19的版本好奇怪,NB在构建时有遇过到这问题不?

jaxen-1.1.6.jar
jdom-2.0.5.jar
有依赖么?

@wendal 不好意思,下午一直在会议中哈。
我的问题不是这个意思,就是在执行 mvn clean package 命令时出了这么个错误,网上找情况是说MAVEN版本问题,更新MAVNE版本后还是一样的,然后分析了项目中各jar的依赖关系, 只是项目引用了guava-20版本,尝试过降低shade插件版本,结果还是一样,有点纳闷的。POM文件如下:

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>io.github.elkan1788</groupId>
    <artifactId>nb-demo</artifactId>
    <version>1.0.0-SNAPSHOT</version>

    <developers>
        <developer>
            <id>0</id>
            <name>elkan</name>
            <email>elkan1788@gmail.com</email>
        </developer>
    </developers>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <slf4j.version>1.7.25</slf4j.version>
        <log4j.version>1.2.17</log4j.version>
        <nutzboot.version>2.2-SNAPSHOT</nutzboot.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-starter-jetty</artifactId>
            <version>${nutzboot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-starter-nutz-mvc</artifactId>
            <version>${nutzboot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-starter-nutz-dao</artifactId>
            <version>${nutzboot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-starter-jdbc</artifactId>
            <version>${nutzboot.version}</version>
        </dependency>

        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-starter-swagger</artifactId>
            <version>${nutzboot.version}</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.4.196</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.1.5</version>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>nutz</id>
            <url>https://jfrog.nutz.cn/artifactory/jcenter</url>
        </repository>
        <repository>
            <id>nutz-snapshots</id>
            <url>https://jfrog.nutz.cn/artifactory/snapshots</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
    </repositories>

    <build>

        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>

        <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>
                    <encoding>${project.build.sourceEncoding}</encoding>
                    <compilerArgs>
                        <arg>-parameters</arg>
                    </compilerArgs>
                    <useIncrementalCompilation>false</useIncrementalCompilation>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <mainClass>io.nutz.demo.MainLauncher</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>

                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>META-INF/nutz/org.nutz.boot.starter.NbStarter</resource>
                                </transformer>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>io.github.elkan1788.nbdemo.MainLauncher</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>

    </build>
</project>

druid删掉试试

我试试你的pom.xml

[INFO] Including org.nutz:nutzboot-starter-jetty:jar:2.2-SNAPSHOT in the shaded jar.
[INFO] Including org.eclipse.jetty:jetty-servlets:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including org.eclipse.jetty:jetty-continuation:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including org.eclipse.jetty:jetty-http:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including org.eclipse.jetty:jetty-util:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including org.eclipse.jetty:jetty-io:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including org.eclipse.jetty:jetty-webapp:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including org.eclipse.jetty:jetty-xml:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including org.eclipse.jetty:jetty-servlet:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including org.eclipse.jetty:jetty-security:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including org.eclipse.jetty:jetty-server:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including org.eclipse.jetty.websocket:websocket-server:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including org.eclipse.jetty.websocket:websocket-common:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including org.eclipse.jetty.websocket:websocket-api:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including org.eclipse.jetty.websocket:websocket-client:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including org.eclipse.jetty:jetty-client:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including org.eclipse.jetty.websocket:websocket-servlet:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including org.eclipse.jetty.websocket:javax-websocket-server-impl:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including org.eclipse.jetty:jetty-annotations:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including org.eclipse.jetty:jetty-plus:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including javax.annotation:javax.annotation-api:jar:1.2 in the shaded jar.
[INFO] Including org.ow2.asm:asm:jar:6.0 in the shaded jar.
[INFO] Including org.ow2.asm:asm-commons:jar:6.0 in the shaded jar.
[INFO] Including org.ow2.asm:asm-tree:jar:6.0 in the shaded jar.
[INFO] Including org.eclipse.jetty.websocket:javax-websocket-client-impl:jar:9.4.8.v20171121 in the shaded jar.
[INFO] Including javax.websocket:javax.websocket-client-api:jar:1.0 in the shaded jar.
[INFO] Including javax.websocket:javax.websocket-api:jar:1.0 in the shaded jar.
[INFO] Including org.slf4j:jul-to-slf4j:jar:1.7.25 in the shaded jar.
[INFO] Including org.nutz:nutz-plugins-websocket:jar:1.r.63.r5 in the shaded jar.
[INFO] Including org.nutz:nutz:jar:1.r.63.r5 in the shaded jar.
[INFO] Including org.nutz:nutzboot-core:jar:2.2-SNAPSHOT in the shaded jar.
[INFO] Including javax.servlet:javax.servlet-api:jar:3.1.0 in the shaded jar.
[INFO] Including org.nutz:nutzboot-starter-nutz-mvc:jar:2.2-SNAPSHOT in the shaded jar.
[INFO] Including org.nutz:nutzboot-starter-nutz-dao:jar:2.2-SNAPSHOT in the shaded jar.
[INFO] Including org.nutz:nutz-plugins-daocache:jar:1.r.63.r5 in the shaded jar.
[INFO] Including org.nutz:nutzboot-starter-jdbc:jar:2.2-SNAPSHOT in the shaded jar.
[INFO] Including org.nutz:nutzboot-starter-swagger:jar:2.2-SNAPSHOT in the shaded jar.
[INFO] Including io.swagger:swagger-servlet:jar:1.5.17 in the shaded jar.
[INFO] Including io.swagger:swagger-core:jar:1.5.17 in the shaded jar.
[INFO] Including org.apache.commons:commons-lang3:jar:3.2.1 in the shaded jar.
[INFO] Including com.fasterxml.jackson.core:jackson-annotations:jar:2.8.9 in the shaded jar.
[INFO] Including com.fasterxml.jackson.core:jackson-databind:jar:2.8.9 in the shaded jar.
[INFO] Including com.fasterxml.jackson.core:jackson-core:jar:2.8.9 in the shaded jar.
[INFO] Including com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.8.9 in the shaded jar.
[INFO] Including org.yaml:snakeyaml:jar:1.17 in the shaded jar.
[INFO] Including io.swagger:swagger-models:jar:1.5.17 in the shaded jar.
[INFO] Including io.swagger:swagger-annotations:jar:1.5.17 in the shaded jar.
[INFO] Including javax.validation:validation-api:jar:1.1.0.Final in the shaded jar.
[INFO] Including org.reflections:reflections:jar:0.9.11 in the shaded jar.
[INFO] Including org.javassist:javassist:jar:3.21.0-GA in the shaded jar.
[INFO] Including com.google.guava:guava:jar:20.0 in the shaded jar.
[INFO] Including org.slf4j:slf4j-log4j12:jar:1.7.25 in the shaded jar.
[INFO] Including org.slf4j:slf4j-api:jar:1.7.25 in the shaded jar.
[INFO] Including log4j:log4j:jar:1.2.17 in the shaded jar.
[INFO] Including com.h2database:h2:jar:1.4.196 in the shaded jar.
[INFO] Including com.alibaba:druid:jar:1.1.5 in the shaded jar.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] javax.websocket-client-api-1.0.jar, javax.websocket-api-1.0.jar define 45 overlapping classes:
[WARNING]   - javax.websocket.Decoder$Text
[WARNING]   - javax.websocket.DeploymentException
[WARNING]   - javax.websocket.SendHandler
[WARNING]   - javax.websocket.ClientEndpointConfig
[WARNING]   - javax.websocket.SendResult
[WARNING]   - javax.websocket.Extension
[WARNING]   - javax.websocket.ClientEndpointConfig$Builder
[WARNING]   - javax.websocket.OnError
[WARNING]   - javax.websocket.PongMessage
[WARNING]   - javax.websocket.Decoder
[WARNING]   - 35 more...
[WARNING] maven-shade-plugin has detected that some class files are
[WARNING] present in two or more JARs. When this happens, only one
[WARNING] single version of the class is copied to the uber jar.
[WARNING] Usually this is not harmful and you can skip these warnings,
[WARNING] otherwise try to manually exclude artifacts based on
[WARNING] mvn dependency:tree -Ddetail=true and the above output.
[WARNING] See http://maven.apache.org/plugins/maven-shade-plugin/
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing C:\Users\Administrator\workspace\git\github\tmp\target\nb-demo-1.0.0-SNAPSHOT.jar with C:\Users\Administrator\workspace\git\github\tmp\target\nb-demo-1.0.0-SNAPSHOT-shaded.jar
[INFO] Dependency-reduced POM written at: C:\Users\Administrator\workspace\git\github\tmp\dependency-reduced-pom.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45.825 s
[INFO] Finished at: 2018-01-11T20:28:34+08:00
[INFO] Final Memory: 37M/293M
[INFO] ------------------------------------------------------------------------

[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ nb-demo ---
[INFO] io.github.elkan1788:nb-demo:jar:1.0.0-SNAPSHOT
[INFO] +- org.nutz:nutzboot-starter-jetty:jar:2.2-SNAPSHOT:compile
[INFO] |  +- org.eclipse.jetty:jetty-servlets:jar:9.4.8.v20171121:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-continuation:jar:9.4.8.v20171121:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-http:jar:9.4.8.v20171121:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-util:jar:9.4.8.v20171121:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-io:jar:9.4.8.v20171121:compile
[INFO] |  +- org.eclipse.jetty:jetty-webapp:jar:9.4.8.v20171121:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-xml:jar:9.4.8.v20171121:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-servlet:jar:9.4.8.v20171121:compile
[INFO] |  |     \- org.eclipse.jetty:jetty-security:jar:9.4.8.v20171121:compile
[INFO] |  |        \- org.eclipse.jetty:jetty-server:jar:9.4.8.v20171121:compile
[INFO] |  +- org.eclipse.jetty.websocket:websocket-server:jar:9.4.8.v20171121:compile
[INFO] |  |  +- org.eclipse.jetty.websocket:websocket-common:jar:9.4.8.v20171121:compile
[INFO] |  |  |  \- org.eclipse.jetty.websocket:websocket-api:jar:9.4.8.v20171121:compile
[INFO] |  |  +- org.eclipse.jetty.websocket:websocket-client:jar:9.4.8.v20171121:compile
[INFO] |  |  |  \- org.eclipse.jetty:jetty-client:jar:9.4.8.v20171121:compile
[INFO] |  |  \- org.eclipse.jetty.websocket:websocket-servlet:jar:9.4.8.v20171121:compile
[INFO] |  +- org.eclipse.jetty.websocket:javax-websocket-server-impl:jar:9.4.8.v20171121:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-annotations:jar:9.4.8.v20171121:compile
[INFO] |  |  |  +- org.eclipse.jetty:jetty-plus:jar:9.4.8.v20171121:compile
[INFO] |  |  |  +- org.ow2.asm:asm:jar:6.0:compile
[INFO] |  |  |  \- org.ow2.asm:asm-commons:jar:6.0:compile
[INFO] |  |  |     \- org.ow2.asm:asm-tree:jar:6.0:compile
[INFO] |  |  +- org.eclipse.jetty.websocket:javax-websocket-client-impl:jar:9.4.8.v20171121:compile
[INFO] |  +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] |  +- org.nutz:nutz-plugins-websocket:jar:1.r.63.r5:compile
[INFO] |  |  \- org.nutz:nutz:jar:1.r.63.r5:compile
[INFO] |  \- org.nutz:nutzboot-core:jar:2.2-SNAPSHOT:compile
[INFO] +- org.nutz:nutzboot-starter-nutz-mvc:jar:2.2-SNAPSHOT:compile
[INFO] +- org.nutz:nutzboot-starter-nutz-dao:jar:2.2-SNAPSHOT:compile
[INFO] |  \- org.nutz:nutz-plugins-daocache:jar:1.r.63.r5:compile
[INFO] +- org.nutz:nutzboot-starter-jdbc:jar:2.2-SNAPSHOT:compile
[INFO] +- org.nutz:nutzboot-starter-swagger:jar:2.2-SNAPSHOT:compile
[INFO] |  \- io.swagger:swagger-servlet:jar:1.5.17:compile
[INFO] |     +- io.swagger:swagger-core:jar:1.5.17:compile
[INFO] |     |  +- org.apache.commons:commons-lang3:jar:3.2.1:compile
[INFO] |     |  |  \- org.yaml:snakeyaml:jar:1.17:compile
[INFO] |     |  +- io.swagger:swagger-models:jar:1.5.17:compile
[INFO] |     |  |  \- io.swagger:swagger-annotations:jar:1.5.17:compile
[INFO] |     +- org.reflections:reflections:jar:0.9.11:compile
[INFO] |     |  \- org.javassist:javassist:jar:3.21.0-GA:compile
[INFO] |     \- com.google.guava:guava:jar:20.0:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.25:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- log4j:log4j:jar:1.2.17:compile

maven版本 apache-maven-3.5.2

只能说是无解啦,我本地用SHADE插件就是无法打包,后来改用ASSEMBLY插件是成功的,引用参考如下:

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>io.github.elkan1788.nbdemo.MainLauncher</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

ASSEMBLY 不会合并starter的标记文件吧

是不是maven版本问题?

你说的是哪个标记文件? 目前测试下来打包的文件是正常运行的。

Maven版本更新到最新的3.5.2问题还是依旧如此。

Maven home: /Users/XXXXXX/DevelopSpaces/apache-maven-3.5.2
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.6", arch: "x86_64", family: "mac"
mvn dependency:tree -Ddetail=true

贴一下输出

嗯,这个方法试,确定没有找到GUAVA-19的版本,信息如下:

[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ nb-demo ---
[INFO] io.github.elkan1788:nb-demo:jar:1.0.0-SNAPSHOT
[INFO] +- org.nutz:nutzboot-starter-jetty:jar:2.2-SNAPSHOT:compile
[INFO] |  +- org.eclipse.jetty:jetty-servlets:jar:9.4.8.v20171121:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-continuation:jar:9.4.8.v20171121:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-http:jar:9.4.8.v20171121:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-util:jar:9.4.8.v20171121:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-io:jar:9.4.8.v20171121:compile
[INFO] |  +- org.eclipse.jetty:jetty-webapp:jar:9.4.8.v20171121:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-xml:jar:9.4.8.v20171121:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-servlet:jar:9.4.8.v20171121:compile
[INFO] |  |     \- org.eclipse.jetty:jetty-security:jar:9.4.8.v20171121:compile
[INFO] |  |        \- org.eclipse.jetty:jetty-server:jar:9.4.8.v20171121:compile
[INFO] |  +- org.eclipse.jetty.websocket:websocket-server:jar:9.4.8.v20171121:compile
[INFO] |  |  +- org.eclipse.jetty.websocket:websocket-common:jar:9.4.8.v20171121:compile
[INFO] |  |  |  \- org.eclipse.jetty.websocket:websocket-api:jar:9.4.8.v20171121:compile
[INFO] |  |  +- org.eclipse.jetty.websocket:websocket-client:jar:9.4.8.v20171121:compile
[INFO] |  |  |  \- org.eclipse.jetty:jetty-client:jar:9.4.8.v20171121:compile
[INFO] |  |  \- org.eclipse.jetty.websocket:websocket-servlet:jar:9.4.8.v20171121:compile
[INFO] |  +- org.eclipse.jetty.websocket:javax-websocket-server-impl:jar:9.4.8.v20171121:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-annotations:jar:9.4.8.v20171121:compile
[INFO] |  |  |  +- org.eclipse.jetty:jetty-plus:jar:9.4.8.v20171121:compile
[INFO] |  |  |  +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] |  |  |  +- org.ow2.asm:asm:jar:6.0:compile
[INFO] |  |  |  \- org.ow2.asm:asm-commons:jar:6.0:compile
[INFO] |  |  |     \- org.ow2.asm:asm-tree:jar:6.0:compile
[INFO] |  |  +- org.eclipse.jetty.websocket:javax-websocket-client-impl:jar:9.4.8.v20171121:compile
[INFO] |  |  |  \- javax.websocket:javax.websocket-client-api:jar:1.0:compile
[INFO] |  |  \- javax.websocket:javax.websocket-api:jar:1.0:compile
[INFO] |  +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] |  +- org.nutz:nutz-plugins-websocket:jar:1.r.65-SNAPSHOT:compile
[INFO] |  |  \- org.nutz:nutz:jar:1.r.65-SNAPSHOT:compile
[INFO] |  \- org.nutz:nutzboot-core:jar:2.2-SNAPSHOT:compile
[INFO] |     \- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] +- org.nutz:nutzboot-starter-nutz-mvc:jar:2.2-SNAPSHOT:compile
[INFO] +- org.nutz:nutzboot-starter-nutz-dao:jar:2.2-SNAPSHOT:compile
[INFO] |  \- org.nutz:nutz-plugins-daocache:jar:1.r.65-SNAPSHOT:compile
[INFO] +- org.nutz:nutzboot-starter-jdbc:jar:2.2-SNAPSHOT:compile
[INFO] |  \- com.alibaba:druid:jar:1.1.5:compile
[INFO] +- org.nutz:nutzboot-starter-swagger:jar:2.2-SNAPSHOT:compile
[INFO] |  \- io.swagger:swagger-servlet:jar:1.5.17:compile
[INFO] |     +- io.swagger:swagger-core:jar:1.5.17:compile
[INFO] |     |  +- org.apache.commons:commons-lang3:jar:3.2.1:compile
[INFO] |     |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.9:compile
[INFO] |     |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.9:compile
[INFO] |     |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.8.9:compile
[INFO] |     |  +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.8.9:compile
[INFO] |     |  |  \- org.yaml:snakeyaml:jar:1.17:compile
[INFO] |     |  +- io.swagger:swagger-models:jar:1.5.17:compile
[INFO] |     |  |  \- io.swagger:swagger-annotations:jar:1.5.17:compile
[INFO] |     |  \- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] |     +- org.reflections:reflections:jar:0.9.11:compile
[INFO] |     |  \- org.javassist:javassist:jar:3.21.0-GA:compile
[INFO] |     \- com.google.guava:guava:jar:20.0:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.25:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- log4j:log4j:jar:1.2.17:compile
[INFO] \- com.h2database:h2:jar:1.4.196:compile

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