nutzboot icon indicating copy to clipboard operation
nutzboot copied to clipboard

NB打包成fatjar的缺陷

Open juqkai opened this issue 1 year ago • 0 comments

在NbApp中有以下代码: Enumeration<URL> _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>

juqkai avatar May 11 '24 00:05 juqkai