Meecrowave Maven

Coordinates:

<plugin>
  <groupId>org.apache.meecrowave</groupId>
  <artifactId>meecrowave-maven-plugin</artifactId>
  <version>${meecrowave.version}</version>
</plugin>
most of the configuration is inherited from meecrowave-core.

Here are the available options (see core configuration for the details):

Name Default Property

cdiConversation

true

${meecrowave.cdiConversation}

clientAuth

-

${meecrowave.clientAuth}

conf

-

${meecrowave.conf}

context

${meecrowave.context}

deleteBaseOnStartup

true

${meecrowave.deleteBaseOnStartup}

dir

-

${meecrowave.dir}

forceLog4j2Shutdown

true

${meecrowave.force-log4j2-shutdown}

host

localhost

${meecrowave.host}

http2

-

${meecrowave.http2}

httpPort

8080

${meecrowave.http}

httpsPort

8443

${meecrowave.https}

injectServletContainerInitializer

true

${meecrowave.servlet-container-initializer-injections}

jaxrsAutoActivateBeanValidation

true

${meecrowave.jaxrs-beanvalidation}

jaxrsDefaultProviders

-

${meecrowave.jaxrs-default-providers}

jaxrsLogProviders

false

${meecrowave.jaxrsLogProviders}

jaxrsMapping

/*

${meecrowave.jaxrsMapping}

jaxrsProviderSetup

true

${meecrowave.jaxrs-provider-setup}

jaxwsSupportIfAvailable

true

${meecrowave.jaxws-support}

jsonbBinaryStrategy

-

${meecrowave.jsonb-binary-strategy}

jsonbEncoding

UTF-8

${meecrowave.jsonb-encoding}

jsonbIJson

false

${meecrowave.jsonb-ijson}

jsonbNamingStrategy

-

${meecrowave.jsonb-naming-strategy}

jsonbNulls

false

${meecrowave.jsonb-nulls}

jsonbOrderStrategy

-

${meecrowave.jsonb-order-strategy}

jsonbPrettify

false

${meecrowave.jsonb-prettify}

jsonpBufferStrategy

QUEUE

${meecrowave.jsonp-buffer-strategy}

jsonpMaxReadBufferLen

65536

${meecrowave.jsonp-max-read-buffer-size}

jsonpMaxStringLen

10485760

${meecrowave.jsonp-max-string-length}

jsonpMaxWriteBufferLen

65536

${meecrowave.jsonp-max-write-buffer-size}

jsonpPrettify

false

${meecrowave.jsonp-prettify}

jsonpSupportsComment

false

${meecrowave.jsonp-comments}

keepServerXmlAsThis

-

${meecrowave.keepServerXmlAsThis}

keyAlias

-

${meecrowave.keyAlias}

keystoreFile

-

${meecrowave.keystoreFile}

keystorePass

-

${meecrowave.keystorePass}

keystoreType

JKS

${meecrowave.keystoreType}

loggingGlobalSetup

true

${meecrowave.logging-global-setup}

meecrowaveProperties

meecrowave.properties

${meecrowave.meecrowave-properties}

modules

${project.build.outputDirectory}

project

${project}

quickSession

true

${meecrowave.quickSession}

scanningExcludes

-

${meecrowave.scanning-include}

scanningIncludes

-

${meecrowave.scanning-exclude}

scanningPackageExcludes

-

${meecrowave.scanning-package-exclude}

scanningPackageIncludes

-

${meecrowave.scanning-package-include}

serverXml

-

${meecrowave.serverXml}

sharedLibraries

-

${meecrowave.shared-libraries}

skip

-

${meecrowave.skip}

skipHttp

-

${meecrowave.skipHttp}

ssl

-

${meecrowave.ssl}

sslProtocol

-

${meecrowave.sslProtocol}

stopPort

8005

${meecrowave.stop}

tempDir

-

${meecrowave.tempDir}

tomcatAccessLogPattern

-

${meecrowave.tomcatAccessLogPattern}

tomcatAutoSetup

true

${meecrowave.tomcatAutoSetup}

tomcatFilter

-

${meecrowave.tomcatFilter}

tomcatNoJmx

true

${meecrowave.tomcatNoJmx}

tomcatScanning

true

${meecrowave.tomcatScanning}

tomcatWrapLoader

true

${meecrowave.jaxrsLogProviders}

useClasspathDeployment

true

${meecrowave.force-classpath-deployment}

useLog4j2JulLogManager

true

${meecrowave.log4j2-jul-bridge}

useShutdownHook

true

${meecrowave.shutdown-hook}

useTomcatDefaults

true

${meecrowave.useTomcatDefaults}

watcherBouncing

0

${meecrowave.watcher-bounding}

webResourceCached

true

${meecrowave.webResourceCached}

webXml

-

${meecrowave.webXml}

webapp

${project.basedir}/src/main/webapp

${meecrowave.webapp}

Bundling

mvn meecrowave:bundle

This maven goal will create a zip/tar.gz (configurable) ready to launch your application.

The layout if the following one:

.
├── bin
│   └── meecrowave.sh
├── conf
│   ├── log4j2.xml
│   └── meecrowave.properties
├── lib
│   └── *.jar
├── logs
│   └── meecrowave.logls l
└── temp

conf folder supports out of the box these files (but you can add your own if needed):

  • log4j2.xml

  • server.xml

  • meecrowave.properties

You can acess the root folder of the distribution reading the system property meecrowave.base.

meecrowave.properties supports all configuration options of the cli (just remove the --): http://openwebbeans.apache.org/meecrowave/meecrowave-core/cli.html.

Note: you can also split like Tomcat MEECROWAVE_BASE and MEECROWAVE_HOME if you want to extract meecrowave stack in a separate folder (from the application) to be able to update it independently.

Shading

Plain Maven shade plugin enables you to build fatjar with Maven.

Points to take care are:

  1. merge CXF resources

  2. merge Log4j2 resources

  3. merge OpenWebBeans resources

  4. merge SPI files (META-INF/services)

  5. ensure signatures are still valid in the aggregated jar

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-shade-plugin</artifactId>
  <version>2.4.3</version>
  <executions>
    <execution>
      <id>bundle</id>
      <phase>package</phase>
      <goals>
        <goal>shade</goal>
      </goals>
      <configuration>
        <shadedClassifierName>fat</shadedClassifierName>
        <shadedArtifactAttached>true</shadedArtifactAttached>
        <dependencyReducedPomLocation>${project.build.directory}/reduced-pom-bundle.xml</dependencyReducedPomLocation>
        <transformers>
          <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
            <mainClass>org.apache.meecrowave.runner.Cli</mainClass>
          </transformer>
          <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
            <resource>META-INF/cxf/bus-extensions.txt</resource>
          </transformer>
          <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
            <resource>log4j2.component.properties</resource>
          </transformer>
          <transformer
              implementation="com.github.edwgiz.mavenShadePlugin.log4j2CacheTransformer.PluginsCacheFileTransformer"/>
          <transformer implementation="org.apache.openwebbeans.maven.shade.OpenWebBeansPropertiesTransformer"/>
          <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
        </transformers>
        <filters>
          <filter>
            <artifact>*:*</artifact>
            <excludes>
              <exclude>META-INF/*.SF</exclude>
              <exclude>META-INF/*.DSA</exclude>
              <exclude>META-INF/*.RSA</exclude>
              <exclude>META-INF/LICENSE.txt</exclude>
              <exclude>META-INF/LICENSE</exclude>
              <exclude>META-INF/NOTICE.txt</exclude>
              <exclude>META-INF/NOTICE</exclude>
            </excludes>
          </filter>
        </filters>
      </configuration>
    </execution>
  </executions>
  <dependencies>
    <dependency>
      <groupId>org.apache.openwebbeans</groupId>
      <artifactId>openwebbeans-maven</artifactId>
      <version>1.7.0</version>
    </dependency>
    <dependency>
      <groupId>com.github.edwgiz</groupId>
      <artifactId>maven-shade-plugin.log4j2-cachefile-transformer</artifactId>
      <version>2.1</version>
    </dependency>
  </dependencies>
</plugin>