Not a multi-module build, but this is how we publish WAR + JAR:
https://maven.apache.org/plugins/maven-war-plugin/war-mojo.html#attachClasses
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.3</version>
<configuration>
<warName>ROOT</warName>
<webappDirectory>target/ROOT</webappDirectory>
<failOnMissingWebXml>true</failOnMissingWebXml>
<attachClasses>true</attachClasses>
</configuration>
</plugin>
The dependency then looks like this (using "classes" which is the
default <attachClasses> classifier):
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>client</artifactId>
<version>3.1.8-SNAPSHOT</version>
<classifier>classes</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>client</artifactId>
<version>3.1.8-SNAPSHOT</version>
<type>war</type>
</dependency>
On Sat, Jan 29, 2022 at 12:01 PM Andy Seaborne <[email protected]> wrote:
>
>
>
> On 28/01/2022 23:43, Bruno Kinoshita wrote:
> > Build passed from tag, with:
> >
> >
> > Apache Maven 3.8.2 (ea98e05a04480131370aa0c110b8c54cf726c06f)
> > Maven home: /opt/apache-maven-3.8.2
> > Java version: 11.0.13, vendor: Ubuntu, runtime:
> > /usr/lib/jvm/java-11-openjdk-amd64
> > Default locale: en_US, platform encoding: UTF-8
> > OS name: "linux", version: "5.4.0-96-generic", arch: "amd64", family: "unix"
> >
> >
> > Looked inside .jar and .tar.gz files in the dist area (binaries and
> > sources), and everything looks good (checked the new -ui module, didn't
> > find node_modules or any other unnecessary files). The jena-fuseki-ui
> > module creates a jar that only contains metadata. Maybe we could skip
> > releasing it in the future? I think as it is, it should be available in the
> > Maven repository as a jar dependency for users, even though it's not usable
> > in any way in Java I think.
>
> We can make it a POM artifact then no jar generated.
>
> Or.
>
> Use the jar to deliver the UI files.
>
> They can be served from the jar. No files on disk. No copying from
> ../jena-fuseki-ui/target/dist/ during jena-fuseki-webapp.
>
> The Jetty content-serving servlet takes URL string - and a jar is
> accessed with URL <jar:file:/pathname.../!/path-in-jar/>.
>
> The path can be determined automatically by looking up the path-in-jar
> as the server starts. The files are places under "src/main/resources/"
>
> I have, experimentally, done a Fuseki module for the UI. This is a
> drop-in to FusekiMain (ditto the admin functions as a drop-in).
>
> These will convert the standalone Fuseki server to being a Fuseki/Main +
> Mod_UI + Mod_Admin, not a webapp+Jetty to run it.
>
> Good for docker.
>
> What I haven't looked at is how to get the WAR file setup with this
> change of build. A war file unpacks its contents to disk and has jars in
> WEB-INF/lib which is the webapps classpath. "Should" work if start-up
> can set the location of static content.
> An alternative is have a prepare step in the build to unpack the jar.
>
> Anyone got experience of delivering JS into a WAR file in a multi-module
> build?
>
> Andy