convert maven plugin into gradle plugin - maven

I'm planning to use aspects-jcabi for benchmarking my methods (http://aspects.jcabi.com/annotation-loggable.html). However, it uses maven-plugin, and my project is on gradle. I'm not yet that familiar with Gradle though.
Can I write the following in gradle (http://aspects.jcabi.com/example-weaving.html)?
<project>
<build>
<plugins>
<plugin>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-maven-plugin</artifactId>
<version>0.8</version>
<executions>
<execution>
<goals>
<goal>ajc</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

Related

understanding Spring Boot Maven Plugin in Multi-Module projects

I'm learning about Spring Boot multi module projects and I try to understand what exactly does spring boot maven plugin.
For example I have 2 different projects. In the first project I have the spring boot maven plugin in the web module:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.4.RELEASE</version>
<configuration>
<mainClass>dgs.web.DemoApplication</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
And in the second project I have this plugin in the data module:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
And this is in the parent pom of the 2nd project:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Can somebody explain me what exaclty does this spring boot maven plugin especially in the second project? And why there is no reference about mainClass. I see this mainClass tag only in the first project.
The maven plugin is for packaging and executing via Maven.
You should read the docs:
https://docs.spring.io/spring-boot/docs/current/reference/html/build-tool-plugins-maven-plugin.html
https://docs.spring.io/spring-boot/docs/2.0.4.RELEASE/maven-plugin/

How can I execute following maven plugin before resolving the dependencies

I am from ANT background and newbie to Maven.
For some reason, I need to execute shell script before maven tries to fetch snapshot dependencies.
So I wrote following plugin configuration, but I not getting how can I make it invoke before resolving dependencies task.
I am using Apache Maven 3.0.5
Following is the part of my pom.xml
<build>
<finalName>edte</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<phase>clean</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>Docs/ci/delete_snapshots.sh</executable>
<arguments>
<argument>${user.home}</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Any help is appreciated.

Maven jarsigner plugin

I just tried to configure the maven jarsigner plugin for signing a jar project.
As far as I can understand, the plugin should run automatically when I run mvn clean package but it doesn't.
I must run mvn clean package jarsigner:sign for the plugin to be executed.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.4</version>
<configuration>
<executions>
<execution>
<id>sign</id>
<phase>package</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<alias>java-code</alias>
<keystore>mykeystore.keystore</keystore>
<keypass>mykeypass</keypass>
<storepass>mystorepass</storepass>
<verbose>true</verbose>
</configuration>
</plugin>
</plugins>
</build>
I could find the error on my own. The configuration element has to be within the execution element.
Thanks.

Maven how to invoke a plugin goal?

In the Tomcat Maven plugin, tomcat7-maven-plugin, how to invoke the goal, tomcat7:deploy, after package phase ? can you please give me concise sample pom file ?
Thanks.
Add an execution for the plugin and tie it to a phase after the package phase, i.e. verify or install..
<build>
<plugins>
<plugin>
<dependency>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>deploy</id>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Generating java from rpc wsdl

I have a pom which generates some java code from an RPC wsdl. The problem is that the code is never generated.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>axistools-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<sourceDirectory>src/main/resources</sourceDirectory>
<outputDirectory>${project.build.directory}/generated/rpc</outputDirectory>
<packageSpace>com.company.wsdl</packageSpace>
<testCases>false</testCases>
<serverSide>true</serverSide>
<subPackageByFileName>false</subPackageByFileName>
</configuration>
<executions>
<execution>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
Any ideas as to why this isnt generating the java code?
After taken a look into your pom I realized your problem. It's not related to calling mvn its based on the configuration you made.
You have configured the axistools-maven-plugin in the pluginManagement area. In this case you need to do this in the build area like this:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>axistools-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
..
</configuration>
<executions>
<execution>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
...
</build>
instead of:
<build>
<pluginManagement>
<plugins>
...
</plugins>
</pluginManagement>
...
</build>
If you configure it correctly you can use mvn clean package or mvn clean install instead of calling mvn axistools:wsdl2java ...

Resources