Skip to content

NB打包成fatjar的缺陷 #303

@juqkai

Description

@juqkai

在NbApp中有以下代码:
Enumeration _en = ctx.getClassLoader().getResources("META-INF/nutz/org.nutz.boot.starter.NbStarter");
会默认读取每个JAR包里面的【META-INF/nutz/org.nutz.boot.starter.NbStarter】文件。
当项目被打包成单一jar时,会导致【META-INF/nutz/org.nutz.boot.starter.NbStarter】被覆盖,从而导致只有一个starter会被加载,其它starter都会丢失。

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <finalName>${project.name}</finalName>
                    <appendAssemblyId>false</appendAssemblyId>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>webapp.HelloApp</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions