Put the page under the maven sub-module, how to access

A maven project user and administrator put two sets of pages in two maven sub-modules, and then use another sub-module to do war,. I would like to ask, how can I access the page of the sub-module

Mar.01,2021

The

sub-module can be packed into jar packages to put static resources such as pages in the META-INF/resources directory. It is important to note that this is part of the servlet 3.0 standard. Your application should also be placed in a container that supports servlet 3.0 (such as tomcat 7 or above).

you can use the assembly plug-in of maven.

refer to my assebly.xml file:

<assembly>
    <id>bin</id>
    <formats>
        <format>jar</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
        <dependencySet>
            <useProjectArtifact>false</useProjectArtifact>
            <outputDirectory>/</outputDirectory>
            <excludes>
                <exclude>**</exclude>
            </excludes>
        </dependencySet>
    </dependencySets>
    <fileSets>
        <fileSet>
            <directory>target/classes</directory>
            <outputDirectory>/</outputDirectory>
            <includes>
                <include>**/*.class</include>
            </includes>
            <excludes>
                <exclude>**/DefaultController.class</exclude>
            </excludes>
        </fileSet>
        <fileSet>
            <directory>WebContent</directory>
            <outputDirectory>META-INF/resources</outputDirectory>
            <includes>
                <include>/WEB-INF/jsp/**</include>
            </includes>
        </fileSet>    
         
        <fileSet>
            <directory>WebContent</directory>
            <outputDirectory>META-INF/resources</outputDirectory>
            <includes>
                <include>js/**</include>
                <include>plugins/**</include>
            </includes>
        </fileSet>
    </fileSets>
</assembly>

correspondingly in pom.xml

...
<plugins>
  <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <descriptors>
                        <descriptor>assembly.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
...
</plugins>

packaged jar will have an extra bin modifier. When you publish other jar, module references, you should also put the modifier with

.
 <dependency>
        <groupId>com.example</groupId>
        <artifactId>myplugin</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <classifier>bin</classifier>
</dependency>
Menu