Skip compilation of integration test in maven project - maven

How do I skip the compilation of integration tests when installing a maven project?
I only found -DskipITs and -DskipTests but they only skip the execution, not the compilation.
I would like to remove the needed test dependencies.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.example.confluence</groupId>
<artifactId>qspaRest</artifactId>
<packaging>atlassian-plugin</packaging>
<name>qspaRest</name>
<version>3.0.4-SNAPSHOT</version>
<description>REST resources needed by the QSPA backend importer for
* getting meta information from a space (name, description, homepage, permissions, ...)</description>
<build>
<sourceDirectory>/Users/example/git/qsparest/qsparest/src/main/java</sourceDirectory>
<scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
<testSourceDirectory>/Users/example/git/qsparest/qsparest/src/test/java</testSourceDirectory>
<outputDirectory>/Users/example/git/qsparest/qsparest/target/classes</outputDirectory>
<testOutputDirectory>/Users/example/git/qsparest/qsparest/target/test-classes</testOutputDirectory>
<resources>
<resource>
<directory>/Users/example/git/qsparest/qsparest/src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>/Users/example/git/qsparest/qsparest/src/test/resources</directory>
</testResource>
</testResources>
<directory>/Users/example/git/qsparest/qsparest/target</directory>
<!-- <finalName>qspaRest-3.0.3-SNAPSHOT</finalName>-->
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
</plugin>
<!-- For install:install-file-->
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
</execution>
</executions>
</plugin>
-->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-2</version>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.0</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.3.1</version>
</plugin>
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.1</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.4.3</version>
</plugin>
<plugin>
<artifactId>maven-rar-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.0-beta-8</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>2.0-beta-7</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.0.4</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-alpha-2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<!-- delete directories that will be generated when you
start the develpment server/client in eclipse
-->
<fileset>
<directory>target</directory>
<includes>
<include>**/*</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-confluence-plugin</artifactId>
<version>3.9</version>
<extensions>true</extensions>
<configuration>
<allowGoogleTracking>false</allowGoogleTracking>
<productVersion>${confluence.version}</productVersion>
<productDataVersion>3.5</productDataVersion>
<productDataPath>${basedir}/src/test/resources/generated-test-resources.zip</productDataPath>
<instructions />
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<releases>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<id>atlassian-public</id>
<url>https://m2proxy.atlassian.com/repository/public</url>
</repository>
<repository>
<releases>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>atlassian-plugin-sdk</id>
<url>file:///Users/example/Desktop/atlassian-plugin-sdk-3.9/repository</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<id>atlassian-public</id>
<url>https://m2proxy.atlassian.com/repository/public</url>
</pluginRepository>
<pluginRepository>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Plugin Repository</name>
<url>http://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.jwebunit</groupId>
<artifactId>jwebunit-htmlunit-plugin</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.atlassian.confluence.plugin</groupId>
<artifactId>func-test</artifactId>
<version>2.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.confluence</groupId>
<artifactId>confluence</artifactId>
<version>${confluence.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.wink</groupId>
<artifactId>wink-client</artifactId>
<version>1.1.3-incubating</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<!--
<dependency>
<groupId>de.example</groupId>
<artifactId>qspaBackend</artifactId>
<version>3.0.3-SNAPSHOT</version>
</dependency>
-->
<!-- TODO: There is no separate confluence artifact, so we depend on the complete backend at the moment
-->
<dependency>
<groupId>de.example</groupId>
<artifactId>qspaJiraModel</artifactId>
<version>3.0.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>de.example</groupId>
<artifactId>qspaConfluenceModel</artifactId>
<version>3.0.4-SNAPSHOT</version>
</dependency>
<!--
-->
</dependencies>
<reporting>
<outputDirectory>/Users/example/git/qsparest/qsparest/target/site</outputDirectory>
</reporting>
<properties>
<amps.version>3.9</amps.version>
<downloadSources>true</downloadSources>
<confluence.data.version>3.5</confluence.data.version>
<downloadJavadocs>true</downloadJavadocs>
<confluence.version>4.1.4</confluence.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<skipTests>true</skipTests>
<!-- Settings for install:install-file-->
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<packaging>${project.packaging}</packaging>
<file>${project.build.directory}/${project.build.finalName}.jar</file>
</properties>
</project>

The property -Dmaven.test.skip=true will skip all tests and also all test compilation, because it is accepted by the failsafe, surefire and compiler plugin. All other properties like -DskipTests will only skip the execution of the tests but the files are still compiled.

Related

Building a spring boot azure function with pipeline fails with following error: Failed to get Azure Functions Core Tools version locally

I am relatively new to azure functions and I am trying to create an azure function in java using spring boot that is triggered by an azure event hub message.
I used an example I found here and changed the relevant code from HTTP trigger to event hub trigger.
Building it locally and deploying it to azure via the maven plugin works without any issues but soon as I try to have this code built by an azure pipeline I get the following error:
[INFO] Step 8 of 8: Installing function extensions if needed
[WARNING] Failed to get Azure Functions Core Tools version locally
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:17 min
[INFO] Finished at: 2022-06-25T13:39:48Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.microsoft.***:***-functions-maven-plugin:1.14.2:package (package-functions) on project cutcloud-token-service: Local Azure Functions Core Tools does not exist or is too old to support function extension installation, skip package phase. To install or update it, see: https://aka.ms/azfunc-install -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
The process '/usr/bin/mvn' failed with exit code 1
my pipeline code:
trigger:
branches:
include:
- master
stages:
- stage: Build
jobs:
- job: Build
steps:
- task: MavenAuthenticate#0
inputs:
mavenServiceConnections: 'nexus'
- task: Maven#3
inputs:
mavenPomFile: 'pom.xml'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
javaHomeOption: 'JDKVersion'
jdkVersionOption: 11
mavenVersionOption: 'Default'
mavenAuthenticateFeed: false
effectivePomSkip: false
sonarQubeRunAnalysis: false
goals: clean package
and here is the pom.xml mostly like in the example with some additional libraries needed by my business logic:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>hello</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Hello Spring Function on Azure</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.6</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<azure.functions.java.library.version>2.0.0</azure.functions.java.library.version>
<azure.functions.maven.plugin.version>1.17.0</azure.functions.maven.plugin.version>
<!-- customize those two properties. The functionAppName should be unique across Azure -->
<functionResourceGroup>my-spring-function-resource-group</functionResourceGroup>
<functionAppName>my-spring-function</functionAppName>
<functionAppRegion>westeurope</functionAppRegion>
<stagingDirectory>${project.build.directory}/azure-functions/${functionAppName}</stagingDirectory>
<start-class>com.example.DemoApplication</start-class>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-adapter-azure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-function-webflux</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>com.microsoft.azure.sdk.iot</groupId>
<artifactId>iot-service-client</artifactId>
<version>1.33.2</version>
</dependency>
<dependency>
<groupId>de.digital.asap.cloud</groupId>
<artifactId>cloud-messages</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>net.gsadev.crypto</groupId>
<artifactId>crypto-lib</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.gatling.highcharts</groupId>
<artifactId>gatling-charts-highcharts</artifactId>
<version>3.7.6</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-dependencies</artifactId>
<version>3.2.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure.functions</groupId>
<artifactId>azure-functions-java-library</artifactId>
<version>${azure.functions.java.library.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-maven-plugin</artifactId>
<version>${azure.functions.maven.plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>4.1.5</version>
<configuration>
<includes>
<include>com.example.loadtest.*</include>
</includes>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-maven-plugin</artifactId>
<configuration>
<resourceGroup>${functionResourceGroup}</resourceGroup>
<appName>${functionAppName}</appName>
<region>${functionAppRegion}</region>
<runtime>
<os>linux</os>
<javaVersion>11</javaVersion>
</runtime>
<appSettings>
<!-- Run Azure Function from package file by default -->
<property>
<name>FUNCTIONS_EXTENSION_VERSION</name>
<value>~4</value>
</property>
<property>
<name>FUNCTIONS_WORKER_RUNTIME</name>
<value>java</value>
</property>
</appSettings>
</configuration>
<executions>
<execution>
<id>package-functions</id>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<overwrite>true</overwrite>
<outputDirectory>
${project.build.directory}/azure-functions/${functionAppName}
</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/azure
</directory>
<includes>
<include>**</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${stagingDirectory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<!--Remove obj folder generated by .NET SDK in maven clean-->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<filesets>
<fileset>
<directory>obj</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>gsadev.nexus</id>
<name>Internal GSIDEV Repository</name>
<url>https://nexus.gsadev.net/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/libs-snapshot-local</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone-local</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/libs-snapshot-local</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone-local</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/libs-release-local</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
What I found strange is that the error does not ocurre if I simply remove the event hub annotation from the trigger method without doing any other changes to the code and/or pom:
#FunctionName("createAndSendToken")
public void run(
// #EventHubTrigger(name = "apiTokenRequests",
// eventHubName = "api-key-requests",
// connection = "EventhubConnectionString",
// consumerGroup = "digiapp",
// cardinality = Cardinality.ONE)
String payload,
final ExecutionContext context
) {
context.getLogger().info("EventHub trigger function execution started");
context.getLogger().info("payload:" + payload);
KeyResponse keyResponse = handleRequest(new KeyRequest(payload), context);
context.getLogger().info("EventHub trigger function execution finished with status " + keyResponse.getStatus());
}
Even more strange: I have an earlier version of the function derieved from an other example (which I don't find any more) that is not using spring.
Here the code with the eventhub trigger can be build by an azure pipeline without any issues.
the pom for that function looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.digital.asap.azure</groupId>
<artifactId>cutcloud-token-service</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Cutcloud Token Service</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<azure.functions.maven.plugin.version>1.14.2</azure.functions.maven.plugin.version>
<azure.functions.java.library.version>1.4.2</azure.functions.java.library.version>
<functionAppName>cutcloud-token-service</functionAppName>
<stagingDirectory>${project.build.directory}/azure-functions/${functionAppName}</stagingDirectory>
</properties>
<repositories>
<repository>
<id>gsadev.nexus</id>
<name>Internal GSADEV Repository</name>
<url>https://nexus.gsadev.net/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.microsoft.azure.functions</groupId>
<artifactId>azure-functions-java-library</artifactId>
<version>${azure.functions.java.library.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.microsoft.azure</groupId>-->
<!-- <artifactId>applicationinsights-core</artifactId>-->
<!-- <version>2.6.3</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.microsoft.azure.sdk.iot</groupId>
<artifactId>iot-service-client</artifactId>
<version>1.33.2</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.5</version>
</dependency>
<dependency>
<groupId>net.gsadev.crypto</groupId>
<artifactId>crypto-lib</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>de.digital.asab.cloud</groupId>
<artifactId>cloud-messages</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
<optional>true</optional>
</dependency>
<!-- <dependency>-->
<!-- <groupId>ch.qos.logback</groupId>-->
<!-- <artifactId>logback-core</artifactId>-->
<!-- <version>1.2.7</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>ch.qos.logback</groupId>-->
<!-- <artifactId>logback-classic</artifactId>-->
<!-- <version>1.2.7</version>-->
<!-- </dependency>-->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.slf4j</groupId>-->
<!-- <artifactId>slf4j-api</artifactId>-->
<!-- <version>1.7.32</version>-->
<!-- </dependency>-->
<!-- Test -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-maven-plugin</artifactId>
<version>${azure.functions.maven.plugin.version}</version>
<configuration>
<appName>${functionAppName}</appName>
<resourceGroup>gsadev-sandbox</resourceGroup>
<appServicePlanName>TestServicePlan</appServicePlanName>
<region>westeurope</region>
<!-- function pricingTier, default to be consumption if not specified -->
<!-- refers https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details#supported-pricing-tiers for all valid values -->
<!-- <pricingTier></pricingTier> -->
<disableAppInsights>false</disableAppInsights>
<runtime>
<!-- runtime os, could be windows, linux or docker-->
<os>linux</os>
<javaVersion>8</javaVersion>
<!-- for docker function, please set the following parameters -->
<!-- <image>[hub-user/]repo-name[:tag]</image> -->
<!-- <serverId></serverId> -->
<!-- <registryUrl></registryUrl> -->
</runtime>
<appSettings>
<property>
<name>FUNCTIONS_EXTENSION_VERSION</name>
<value>~3</value>
</property>
</appSettings>
</configuration>
<executions>
<execution>
<id>package-functions</id>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<overwrite>true</overwrite>
<outputDirectory>${stagingDirectory}</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}</directory>
<includes>
<include>host.json</include>
<include>local.settings.json</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${stagingDirectory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<includeScope>runtime</includeScope>
<excludeArtifactIds>azure-functions-java-library</excludeArtifactIds>
</configuration>
</execution>
</executions>
</plugin>
<!--Remove obj folder generated by .NET SDK in maven clean-->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<filesets>
<fileset>
<directory>obj</directory>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>
</project>
The code and annotation for the older function trigger is the same as in the new code that can't be built for some reason.
I already tried different things like changing the version of the maven plugin, the azure libraries, the function version, and the extension bundle versions. etc.
I also tried different build/agent images:
pool:
vmImage: 'ubuntu-latest'
and
pool:
vmImage: 'ubuntu-22.04'
but nothing helped. I am out of ideas. Can anyone help, please?
regards
Christian
Because of the reasons mentioned above, I am still not convinced that this is the best solution but following the comment of #khmarbaise, I fixed my problem by installing the necessary tools manually into the build agent before calling the actual build step:
- task: Npm#1
inputs:
#this is needed so that the function extension install in the maven task doesn't fail
command: 'custom'
customCommand: 'install -g azure-functions-core-tools#3 --unsafe-perm true'

Spring-boot no maven parent and unittests not running

I tried modifying the spring-boot-sample-integration project's Maven build in the samples to not use a parent spring-boot-starter-parent, but to import the spring-boot-dependencies pom in the dependency management. This is because I would like to use spring boot as a Maven module to an existing project.
All build ok; however, the junit test does not run on the Maven install lifecycle. I´m wondering what else I need to do and why the difference. Below is the pom I used. I did not modify any of the sample classes. I just modified the pom. Any help would be most appreciated.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-boot-samples</artifactId>
<version>1.0-SNAPSHOT</version>
<groupId>org.springframework.boot</groupId>
<properties>
<main.basedir>${basedir}</main.basedir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<repositories>
<repository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</pluginRepository>
<pluginRepository>
<id>Central</id>
<url>http://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.2.0.BUILD-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-jmx</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-ip</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-xml</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<argLine>-XX:MaxPermSize=128m -Xmx256m</argLine>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<runOrder>alphabetical</runOrder>
<argLine>-Dfile.encoding=${project.build.sourceEncoding}</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.2.0.BUILD-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Our convention is to end our test with Tests instead of Test so you need to instruct the maven-surefire-pluginabout our default.
Something like
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*Tests.java</include>
</includes>
<excludes>
<exclude>**/Abstract*.java</exclude>
</excludes>
</configuration>
</plugin>

Using Scalatra 2.2.1 with Maven

Has anyone been successful for using Maven and Scalatra 2.2.1?
I found this old archetype https://github.com/Srirangan/scalatra-maven-prototype and tried to update the dependency versions, but I keep hitting incompatibility issues.
I'd like to use:
Scalatra 2.2.1
Scala 2.10
I think that Jetty has some problems to run the produced war.
I would highly appreciate your help on this one.
Here's the example project which I am using:
http://www.scalatra.org/2.2/getting-started/first-project.html
And my current pom.xml:
<?xml version='1.0' encoding='UTF-8'?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-scalatra-web-app</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<properties>
<scalatra.version>2.2.1</scalatra.version>
</properties>
<build>
<finalName>scalatra-maven-prototype</finalName>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<args>
<arg>-make:transitive</arg>
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<useFile>false</useFile>
<disableXmlReport>true</disableXmlReport>
<includes>
<include>**/*Test.*</include>
<include>**/*Suite.*</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.17</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.scalatra</groupId>
<artifactId>scalatra_2.10</artifactId>
<version>${scalatra.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.scalatra</groupId>
<artifactId>scalatra-scalate_2.10</artifactId>
<version>${scalatra.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.scalatra</groupId>
<artifactId>scalatra-specs2_2.10</artifactId>
<version>${scalatra.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api</artifactId>
<version>3.0.20100224</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.6</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.10.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>SonatypeNexusSnapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<repository>
<id>FuseSourceSnapshotRepository</id>
<name>FuseSource Snapshot Repository</name>
<url>http://repo.fusesource.com/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>ScalaToolsMaven2Repository</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases/</url>
</repository>
<repository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</pluginRepository>
</pluginRepositories>
</project>
Ok after a lot of crying, I found the correct versions to use, and the correct artifacts.
Hope that it'll be helpful for someone:
<?xml version='1.0' encoding='UTF-8'?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-scalatra-web-app</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<properties>
<scalatra.version>2.2.1</scalatra.version>
</properties>
<build>
<finalName>scalatra-maven-prototype</finalName>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<args>
<arg>-make:transitive</arg>
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<useFile>false</useFile>
<disableXmlReport>true</disableXmlReport>
<includes>
<include>**/*Test.*</include>
<include>**/*Suite.*</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.0.4.v20130625</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.scalatra</groupId>
<artifactId>scalatra_2.10</artifactId>
<version>${scalatra.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.scalatra</groupId>
<artifactId>scalatra-scalate_2.10</artifactId>
<version>${scalatra.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.scalatra</groupId>
<artifactId>scalatra-specs2_2.10</artifactId>
<version>${scalatra.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
<version>3.0.0.v201112011016</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>9.0.4.v20130625</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.13</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.10.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>SonatypeNexusSnapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<repository>
<id>FuseSourceSnapshotRepository</id>
<name>FuseSource Snapshot Repository</name>
<url>http://repo.fusesource.com/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>ScalaToolsMaven2Repository</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases/</url>
</repository>
<repository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</pluginRepository>
</pluginRepositories>
</project>

Unknown package: mule-module error after running mvn archetype for cloud connector creation via DevKit

i've created a new Cloud Connector using DevKit, after running:
mvn clean package -Ddevkit.studio.package.skip=false
The project shows errors in the pom.file:
Project build error: Unknown packaging: mule-module pom.xml /http-https-component
And:
Project build error: Unresolveable build extension: Plugin org.mule.tools.devkit:mule-devkit-maven-plugin:3.4.0 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:1.6 at specified path C:\Program Files\Java\jre6/../lib/tools.jar pom.xml /http-https-component
This is my entire current pom.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mulesoft</groupId>
<artifactId>http-https-component</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>mule-module</packaging>
<name>Mule Cloud Connector</name>
<properties>
<mule.version>3.4.0</mule.version>
<mule.devkit.version>3.4.0</mule.devkit.version>
<junit.version>4.9</junit.version>
<mockito.version>1.8.2</mockito.version>
<jdk.version>1.6</jdk.version>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.mule.tools.devkit</groupId>
<artifactId>mule-devkit-maven-plugin</artifactId>
<version>${mule.devkit.version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.mule.tools.devkit</groupId>
<artifactId>mule-devkit-maven-plugin</artifactId>
<versionRange>[2.0,)</versionRange>
<goals>
<goal>attach-test-resources</goal>
<goal>filter-resources</goal>
<goal>generate-sources</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<compilerArgument>-proc:none</compilerArgument>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</execution>
<execution>
<id>default-testCompile</id>
<configuration>
<compilerArgument>-proc:none</compilerArgument>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.mule.tools.devkit</groupId>
<artifactId>mule-devkit-maven-plugin</artifactId>
<version>${mule.devkit.version}</version>
</plugin><plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<excludePackageNames>org.mule.tooling.ui.contribution:*</excludePackageNames>
<docletArtifact>
<groupId>org.mule.tools.devkit</groupId>
<artifactId>mule-devkit-doclet</artifactId>
<version>${mule.devkit.version}</version>
</docletArtifact>
<doclet>org.mule.devkit.doclet.Doclava</doclet>
<bootclasspath>${sun.boot.class.path}</bootclasspath>
<additionalparam>
-quiet
-federate JDK http://download.oracle.com/javase/6/docs/api/index.html?
-federationxml JDK http://doclava.googlecode.com/svn/static/api/openjdk-6.xml
-hdf project.artifactId "${project.artifactId}"
-hdf project.groupId "${project.groupId}"
-hdf project.version "${project.version}"
-hdf project.name "${project.name}"
-hdf project.repo.name "${project.distributionManagement.repository.name}"
-hdf project.repo.id "${project.distributionManagement.repository.id}"
-hdf project.repo.url "${project.distributionManagement.repository.url}"
-hdf project.snapshotRepo.name "${project.distributionManagement.snapshotRepository.name}"
-hdf project.snapshotRepo.id "${project.distributionManagement.snapshotRepository.id}"
-hdf project.snapshotRepo.url "${project.distributionManagement.snapshotRepository.url}"
-d ${project.build.directory}/apidocs
</additionalparam>
<useStandardDocletOptions>false</useStandardDocletOptions>
<additionalJOption>-J-Xmx1024m</additionalJOption>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0-alpha-4</version>
<executions>
<execution>
<id>enforce-maven-version</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>[3.0.0,)</version>
</requireMavenVersion>
<requireJavaVersion>
<version>[1.6.0,)</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<filtering>false</filtering>
<directory>src/main/resources</directory>
</resource>
<resource>
<filtering>true</filtering>
<directory>src/test/resources</directory>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>org.mule</groupId>
<artifactId>mule-core</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-spring-config</artifactId>
<version>${mule.version}</version>
</dependency>
<dependency>
<groupId>org.mule.tools.devkit</groupId>
<artifactId>mule-devkit-annotations</artifactId>
<version>${mule.devkit.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>eclipse-workbench</artifactId>
<version>3.6.1.M20100826-1330</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>eclipse-runtime</artifactId>
<version>3.6.0.v20100505</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>core</artifactId>
<version>4.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mule.tests</groupId>
<artifactId>mule-tests-functional</artifactId>
<version>${mule.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>http://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-snapshots</id>
<name>MuleSoft Snapshots Repository</name>
<url>http://repository.mulesoft.org/snapshots/</url>
<layout>default</layout>
</repository>
<repository>
<id>codehaus-releases</id>
<name>CodeHaus Releases</name>
<url>http://repository.codehaus.org/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>mulesoft-plugin-releases</id>
<name>MuleSoft Release Repository</name>
<url>http://repository.mulesoft.org/releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>mulesoft-plugin-snapshots</id>
<name>MuleSoft Snapshot Repository</name>
<url>http://repository.mulesoft.org/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
This is part of my settings.xml in m2 folder:
<mirrors>
<mirror>
<id>mulesoft-release</id>
<mirrorOf>muleforge-release</mirrorOf>
<name>Mulesoft Release Repository</name>
<url>http://repository.mulesoft.org/releases/</url>
</mirror>
<mirror>
<id>mulesoft-snapshot</id>
<mirrorOf>muleforge-snapshot</mirrorOf>
<name>Mulesoft Snapshot Repository</name>
<url>http://repository.mulesoft.org/snapshots/</url>
</mirror>
<mirror>
Thanks in advance.
The packaging is mule not mule-module.
EDIT: Also make sure you have org.mule.tools in your settings.xml pluginGroups:
<pluginGroups>
<pluginGroup>org.mule.tools</pluginGroup>
...
</pluginGroups>
change AnypointStudio's Default JRE to jdk->jre, For example:
old:C:\Program Files\Java\jre7
new:C:\Program Files\Java\jdk1.7.0_71\jre
Use this:
<plugin>
<groupId>org.mule.tools</groupId>
<artifactId>maven-mule-plugin</artifactId>
<version>1.9</version>
<extensions>true</extensions>
<configuration>
<excludeMuleDependencies>false</excludeMuleDependencies>
<copyToAppsDirectory>true</copyToAppsDirectory>
<inclusions>
<inclusion>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-requester</artifactId>
</inclusion>
<inclusion>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-requester</artifactId>
</inclusion>
<inclusion>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-apikit</artifactId>
</inclusion>
</inclusions>
</configuration>
</plugin>

maven checkstyle plugin and guava / google-collections dependency clash

In our multiple module maven (3) project we are utilising the maven checkstyle plugin. It looks like that since we've shifted the guava dependency to our parent pom, we can't execute successfully the checkstyle:checkstyle goal anymore, because it fails with the following exception:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-
plugin:2.10:checkstyle (default-cli) on project init: Execution default-cli of goal
org.apache.maven.plugins:maven-checkstyle-plugin:2.10:checkstyle failed: An API
incompatibility was encountered while executing org.apache.maven.plugins:maven-
checkstyle-plugin:2.10:checkstyle: java.lang.NoSuchMethodError:
com.google.common.collect.ImmutableSortedSet.of([Ljava/lang/Comparable;)Lcom/google
/common/collect/ImmutableSortedSet;
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-checkstyle-plugin:2.10
The reason might be that the maven checkstyle plugin depends on the checkstyle framework, which depends on the google-collections framework (that is nowadays included in the google guava framework), i.e., that checkstyle calls a method that is not part of google collections in guava anymore.
Here is an excerpt of the parent pom that were are utilising:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ourcompany.ourproject</groupId>
<artifactId>ourproject</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>our project</name>
<modules>
<module>init</module>
...
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>4.11</junit.version>
<maven-compiler-plugin.version>3.0</maven-compiler-plugin.version>
<maven-surefire-plugin.version>2.14</maven-surefire-plugin.version>
<maven-checkstyle-plugin.version>2.10</maven-checkstyle-plugin.version>
<maven-pmd-plugin.version>3.0.1</maven-pmd-plugin.version>
<maven-resources-plugin.version>2.6</maven-resources-plugin.version>
<java.source.version>1.6</java.source.version>
<java.target.version>1.6</java.target.version>
<google.guava.version>14.0.1</google.guava.version>
</properties>
<repositories>
<repository>
<id>nexus</id>
<name>Internal Maven Repository</name>
<url>http://ourinternalmavenrepository/nexus/content/groups/public</url>
</repository>
...
</repositories>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<executions>
<execution>
<id>default-test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<source>${java.source.version}</source>
<target>${java.source.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${java.source.version}</source>
<target>${java.source.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven-resources-plugin.version}</version>
<configuration>
<source>${java.source.version}</source>
<target>${java.source.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
...
<distributionManagement>
<repository>
<id>deployment</id>
<name>Internal Releases</name>
<url>http://ourinternalmavenrepository/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>deployment</id>
<name>Internal Releases</name>
<url>http://ourinternalmavenrepository/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<profiles>
...
<profile>
<id>metrics</id>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<!-- CHECKSTYLE -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
<configuration>
<configLocation>our_checkstyle.xml</configLocation>
<failsOnError>false</failsOnError>
<consoleOutput>true</consoleOutput>
<source>${java.source.version}</source>
<target>${java.source.version}</target>
</configuration>
<dependencies>
<dependency>
<groupId>com.ourcompany.ourproject</groupId>
<artifactId>init</artifactId>
<version>0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>${maven-pmd-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<failsOnError>false</failsOnError>
<source>${java.source.version}</source>
<target>${java.source.version}</target>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
<configuration>
<configLocation>our_checkstyle.xml</configLocation>
<targetJdk>${java.source.version}</targetJdk>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>${maven-pmd-plugin.version}</version>
<configuration>
<targetJdk>${java.source.version}</targetJdk>
</configuration>
</plugin>
</plugins>
</reporting>
</profile>
</profiles>
<!-- <dependencyManagement> -->
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
...
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${google.guava.version}</version>
</dependency>
...
</dependencies>
<!-- </dependencyManagement> -->
I think that utilising the maven checkstyle plugin in a maven project is very common as well as utilising the guava framework. So I'm really wondering what we are doing wrong here ;)
Thanks a lot #AndrewLogvinov. He prodivded the working solution in his comment to this question. One just needs to add the google-collections dependency to the dependencies of the maven-checkstyle-plugin:
<dependency>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
<version>1.0</version>
</dependency>

Resources