EJB client from interfaces - java

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>

Related

how to apply semantic versioning to the java maven project to automatically increment the version inside pom.xml

Can anyone please tell me how to apply the semver to the java maven project? I tried many ways, but I didn't find any useful resources to automatically increase the version when I push the code to the branch. I'm using Github action workflow to deploy the project into GitHub.
Thank you.
My first approach is to use the command line but you have to configuration the following in your pom file before. You can of course directly use the command line and put everything on the plain command without this setup but it's very inconvenient
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.9.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.9.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<executions>
<execution>
<id>major</id>
<goals>
<goal>set</goal>
</goals>
<configuration>
<generateBackupPoms>false</generateBackupPoms>
<newVersion>${parsedVersion.nextMajorVersion}.0.0-SNAPSHOT</newVersion>
</configuration>
</execution>
<execution>
<id>minor</id>
<goals>
<goal>set</goal>
</goals>
<configuration>
<generateBackupPoms>false</generateBackupPoms>
<newVersion>${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion}.0-SNAPSHOT</newVersion>
</configuration>
</execution>
<execution>
<id>patch</id>
<goals>
<goal>set</goal>
</goals>
<configuration>
<generateBackupPoms>false</generateBackupPoms>
<newVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.nextIncrementalVersion}-SNAPSHOT</newVersion>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>parse-version</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
By using the above configuration you can change/update the version of your project like this:
mvn build-helper:parse-version versions:set#major
This will increment the major version and set minor and patch version to 0.
mvn build-helper:parse-version versions:set#minor
This will increment the minor version and set patch version to zero.
mvn build-helper:parse-version versions:set#patch
this will increment the patch version. Afterwards you have to commit your changed back into your version control system (for example git).
I recommend to define this kind of setup into a parent pom and reuse it for multiple projects. A detail explanation why and how this works can be found here https://blog.soebes.de/blog/2021/04/05/maven-plugin-configuration/
Using the maven-release-plugin is also an option. It will make also the tags in your version control.

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-site-plugin could not load generated sources (Jaxb)

I try to build my java Project with the maven:site plugin.
For that I use a Jenkins Server and configure the mvn goals: clean install site
My Pom has the following Plugins:
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.5</version>
<configuration>
<goal>generate-sources</goal>
<generateReports>true</generateReports>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<configuration>
<show>private</show>
</configuration>
</plugin>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<reportSets>
<reportSet>
<reports>
<report>checkstyle</report>
</reports>
</reportSet>
</reportSets>
<configuration>
<failsOnError>true</failsOnError>
<configLocation>checkstyle.xml</configLocation>
</configuration>
</plugin>
..
The Programm runs and the generated Classes are available. But if i made a site-build i get the error that the generated package doesn't exist.
Thank you for your help
I used this in pom where jaxb is:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>target/generated-sources/jaxb/</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>

Maven Multi Module Hot deploy in Jboss

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>

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