Maven Multi Module Hot deploy in Jboss - java

We have a multi-module maven project, which has to be deployed in Jboss 7.1.1 server. It takes most of our time redeploying for code changes. Have seen to use Jrebel for hot deployment, but the expense will not meet to us with 20 developers.
So is there any workaround for hot deployment of maven-multi-module project in Jboss?
Here is build configuration of our project in POM:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.1.0.Beta1b</version>
<inherited>true</inherited>
<configuration>
<hostname>localhost</hostname>
<port>9999</port>
<filename>${project.build.finalName}.ear</filename>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>

Related

springboot maven running as init.d service on linux not working

I have maven spring-boot application running as an init.d service on ec2 instance - it is working fine in the lower-level environment but when I do the same on prod instance I am getting "Failed to load Main-Class manifest attribute from /path/application.war. I have tried all possible google solutions but nothing helped to resolve as it is working at the lower level and all configs and versions are the same on both instances. attaching maven build block below. when I unzip the war I see the main-class and start-class in manifest file.
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<fork>true</fork>
<executable>true</executable>
<profiles>dev</profiles>
<jvmArguments>-Xdebug
-Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n</jvmArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>

Maven: JavaFX: Bundle libs in one Jar File

I need a solution to pack all lib-files into the executable jar-file.I use Maven and the Maven plugins javafx-maven-plugin, maven-compiler-plugin and maven-surefire-plugin. I haven't found a solution for my problem based on these plugins yet.
I hope someone can help me. Here are the configurations of the plugins.
<build>
<plugins>
<!-- https://github.com/javafx-maven-plugin/javafx-maven-plugin -->
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.1.4</version>
<configuration>
<mainClass>${exec.mainClass}</mainClass>
<verbose>true</verbose>
<jfxAppOutputDir>${project.basedir}/target/output</jfxAppOutputDir>
<jfxMainAppJarName>${project.name}.jar</jfxMainAppJarName>
<allPermissions>true</allPermissions>
<manifestAttributes>
<Specification-Title>${project.name}</Specification-Title>
<Specification-Version>${project.version}</Specification-Version>
<Specification-Vendor>${project.organization.name}</Specification-Vendor>
<Implementation-Title>${project.name}</Implementation-Title>
<Implementation-Version>${build.number}</Implementation-Version>
<Implementation-Vendor-Id>${project.groupId}</Implementation-Vendor-Id>
<Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
<Implementation-URL>${project.organization.url}</Implementation-URL>
</manifestAttributes>
</configuration>
<executions>
<execution>
<id>create-jfxjar</id>
<phase>package</phase>
<goals>
<goal>build-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerArguments>
<bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<skipTests>false</skipTests>
<properties>
<property>
<name>listener</name>
<value>org.sonar.java.jacoco.JUnitListener</value>
</property>
</properties>
</configuration>
</plugin>
</plugins>
</build>
What you are looking for is called uber-jar or shaded jar. You can use the following maven-plugin:
Maven Shade Plugin
Selecting Contents for Uber JAR

EJB client from interfaces

I read this, but cannot fix my issue.
I have java module where all files are java interfaces (screenshot).
<build>
<finalName>tsm-mno-external-services</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<configuration>
<generateClient>true</generateClient>
<clientIncludes>
<clientInclude>com/test/ExternalCustomerCareServicesRemote.java</clientInclude>
</clientIncludes>
</configuration>
</plugin>
</plugins>
</build>
When Im run maven goal, ejb *-client.jar is not generated (In other modules with contains classed ejb *-client.jar generated without problems).
So question is next: can i generate ejb client from interfaces?
There as an error in my pom.xml, so *-client.jar is not generated at package phase.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<configuration>
<goal>package</goal>
<generateClient>true</generateClient>
<clientIncludes>
<clientInclude>path/**</clientInclude>
</clientIncludes>
</configuration>
<executions>
<execution>
<goals>
<goal>ejb</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>

Download source jars using Maven2 and pom

I am using Maven2 to build my project. I want my build to automatically download dependency source jars when it is compiled. Dependency executable jars are downloading correctly. My dependency looks like this:
...
<dependencies>
<dependency>
<groupId>id.name</groupId>
<artifactId>artifact-name</artifactId>
<version>1403.00</version>
</dependency>
</dependencies>
...
I do have the maven source plugin:
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
...
I've also tried adding this configuration to the pom under the maven-source-plugin:
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
What do I need to add to my pom file to make this happen?
Add this to your POM:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>download-sources</id>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin>

Maven multi-module project site with javadocs

I would like use Maven for creating site for my application. This is a multi-module app, the parent module is simple site module, and first child is a core of app, the second is a GUI (Swing).
I now use follow for parent pom.xml
<modules>
<module>core</module>
<module>kayako-desktop</module>
</modules>
<build>
<plugins>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>2.2</version>
<configuration>
<locales>en</locales>
</configuration>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<aggregate>true</aggregate>
</configuration>
</plugin>
<plugin>
<artifactId>maven-changes-plugin</artifactId>
<version>2.4</version>
</plugin>
</plugins>
</reporting>
My core's pom:
<build>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<phase>package</phase>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
<goal>javadoc</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<links>
<link>http://download.oracle.com/javase/6/docs/api/</link>
</links>
</configuration>
</plugin>
</plugins>
</reporting>
(I stripped out unrelated parts from both)
The problem: I tried mvn site:stage, but javadoc is not collected from core module. What do I wrong?
Configure the javadoc plugin in the <reportPlugins> section of the configuration for the maven-site-plugin, in the parent pom.
Here's what worked for me.
In the parent pom:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<reportSets>
<reportSet>
<id>aggregate</id>
<reports>
<report>aggregate</report>
</reports>
</reportSet>
</reportSets>
<configuration>
<!-- Here you can add special configurations for your javadoc, if needed -->
</configuration>
</plugin>
<!-- Here you can also configure more report plugins -->
<!-- for your site, such as maven-project-info-reports-plugin -->
</reportPlugins>
</configuration>
</plugin>
<!-- ... -->
</plugins>
</build>
<!-- ... -->
<distributionManagement>
<site>
<id>website</id>
<url>http://site.url/can/be/tentative/or/hypothetical</url>
</site>
</distributionManagement>
In each of the child poms, you can also configure specific reports for the site plugin, for example, surefire test reports or project info. However, you shouldn't need to place any javadoc plugin configurations there (unless you also want non-aggregated javadocs for your child modules).
You should then be able to do mvn site site:stage from the parent directory. To view your aggregated javadocs, point your browser to target/staging/index.html in that directory, and click "Project Reports" and then "JavaDocs" in the index on the left-hand side of the page.
Additional tip:
Sometimes I want to look quickly at the aggregated javadocs without having to do an entire site site:stage, which does more stuff and takes longer. So I also include a configuration for the maven-javadoc-plugin directly in the <plugin> section of the parent pom. That way, I can run mvn javadoc:aggregate and quickly get the aggregated javadocs in target/site/apidocs/index.html.

Categories

Resources