I really need help here.
Objective: Run my cucumber integration tests using Cucumber-Java8 version 6.7.0 with Maven 3.6.3.
Actual Scenario: When I run maven using this command: $ mvn clean verify -Pintegration-tests I am receiving this result.
xxxxx # xxx <Project Name> % mvn clean verify -Pintegration-tests
[INFO] Scanning for projects...
[INFO]
[INFO] ----------< <Project Name> >----------
[INFO] Building <Project Name> 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) # <Project Name> ---
[INFO] Deleting /Users/<home>/Documents/repos/xxx/<Project Name>/target
[INFO]
[INFO] --- build-helper-maven-plugin:3.1.0:add-test-source (add-source) # <Project Name> ---
***[INFO] Test Source directory: /Users/<home>/Documents/repos/xxxx/<Project Name>/src/testintegration added.***
[INFO]
[INFO] --- build-helper-maven-plugin:3.1.0:add-test-resource (add-resource) # <Project Name ---
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) # <Project Name> ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 13 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # <Project Name> ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 223 source files to /Users/<home>/Documents/repos/xxx/<Project Name>
...
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) # <Project Name> ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 15 resources
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) # n<Project Name> ---
[INFO] Changes detected - recompiling the module!
...
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) # <Project Name> ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) # <Project Name> ---
[INFO] Building jar: /Users/<home>/Documents/repos/xxxx/<Project Name> -server/target/<Project Name>.jar
[INFO]
[INFO] --- maven-failsafe-plugin:2.22.2:integration-test (default) # <Project Name> ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-failsafe-plugin:2.22.2:verify (default) # <Project Name> ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.484 s
[INFO] Finished at: 2020-10-17T13:07:50+01:00
[INFO] ------------------------------------------------------------------------
I didn't put any code in my Definition Class except "Sysout" and assertTrue. The Integration Test runs when I use a runner that I created trigger by Intellij.
#RunWith(Cucumber.class)
#CucumberOptions(
features = {"src/testintegration/java/features"},
glue = {"steps"},
plugin = {"pretty", "html:target/cucumber"},
publish = true)
public class RunCucumberIT {
Code Scenario Actual
Sctructure of the Project - Intellij
Maven File - Snipped
<!-- Integration tests -->
<profiles>
<profile>
<id>integration-tests</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<cucumber.plugin>json:target/report.json</cucumber.plugin>
<cucumber.filter.tags>#wip</cucumber.filter.tags>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/testintegration/</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-resource</id>
<phase>generate-sources</phase>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/testintegration/resources/features</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- block unit tests execution -->
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<systemPropertyVariables>
<cucumber.plugin>${cucumber.plugin}</cucumber.plugin>
<cucumber.filter.tags>${cucumber.filter.tags}</cucumber.filter.tags>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- Cucumber -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java8</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>6.2.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
Definition Class
package steps;
import static org.junit.jupiter.api.Assertions.assertTrue;
import io.cucumber.java8.En;
public class Authorization implements En {
public Authorization() {
Given("the system knows about the following attributes",
(io.cucumber.datatable.DataTable dataTable) -> {
System.out.println("AUTHORIZATION GIVEN TEST");
assertTrue(true);
});
When("the client request POST \\/login", () -> {
System.out.println("AUTHORIZATION When TEST");
assertTrue(true);
});
Then("the response should be JSON", (io.cucumber.datatable.DataTable dataTable) -> {
System.out.println("AUTHORIZATION Then TEST");
assertTrue(true);
});
}
}
Part of Feature File
Feature: Authorization
#wip
Scenario: Login into account
...
Runner Class - (When I trigger this class by Intellij my test run correctly
package runner;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
#RunWith(Cucumber.class)
#CucumberOptions(
features = {"src/testintegration/java/features"},
glue = {"steps"},
plugin = {"pretty", "html:target/cucumber"},
publish = true)
public class RunCucumberIT {
}
I used this page here to try to do work my tests. But to be honest I don't know if I am doing something wrong or the article is missing something.
Here is the website.(weblogism)
Please, could someone check the Pom.xml file? I think I am missing something.
Many thanks if someone can help me here.
Cheers,
Related
I am try to deploy Java Azure function app from my local machine. My tech stack is fallows,
Azure Function App OS: Linux
Azure Functions Core Tools (2.0.3)
Springboot 2.6.3
spring-boot-maven-plugin 2.6.3
azure-functions-maven-plugin 1.14.3
azure-functions-java-library 1.4.2
spring-cloud-function-adapter-azure 3.2.1
Here is my pom.xml
<?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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.avol.func</groupId>
<artifactId>springcloud-eh-func</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Azure Java Functions</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>11</java.version>
<azure.functions.maven.plugin.version>1.14.3</azure.functions.maven.plugin.version>
<azure.functions.java.library.version>1.4.2</azure.functions.java.library.version>
<functionAppName>poc-java-func-apsp</functionAppName>
<resource.groupname>AvolPOCs</resource.groupname>
<appserviceplan.name>ASP-AvolPOCs-84f2</appserviceplan.name>
<azure.region>southcentralus</azure.region>
<azure.subscriptionid>xxxxxx</azure.subscriptionid>
<stagingDirectory>${project.build.directory}/azure-functions/${functionAppName}</stagingDirectory>
<start-class>com.avol.func.SpringAppRunner</start-class>
</properties>
<dependencies>
<dependency>
<groupId>com.microsoft.azure.functions</groupId>
<artifactId>azure-functions-java-library</artifactId>
<version>${azure.functions.java.library.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-adapter-azure</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-spring-boot-starter</artifactId>
<version>2.6.3</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-logging-logback</artifactId>
<version>2.6.3</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.2.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-dependencies</artifactId>
<version>3.2.1</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>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<filesets>
<fileset>
<directory>obj</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.2.0</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>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-maven-plugin</artifactId>
<version>${azure.functions.maven.plugin.version}</version>
<configuration>
<subscriptionId>${azure.subscriptionid}</subscriptionId>
<!-- function app name -->
<appName>${functionAppName}</appName>
<!-- function app resource group -->
<resourceGroup>${resource.groupname}</resourceGroup>
<!-- function app service plan name -->
<appServicePlanName>${appserviceplan.name}</appServicePlanName>
<!-- function app region-->
<!-- refers https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details#supported-regions for all valid values -->
<region>${azure.region}</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> -->
<!-- Whether to disable application insights, default is false -->
<disableAppInsights>false</disableAppInsights>
<runtime>
<os>linux</os>
<javaVersion>11</javaVersion>
</runtime>
<appSettings>
<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>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<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/resources
</directory>
<includes>
<include>**</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.6.3</version>
<dependencies>
<dependency>
<groupId>org.springframework.boot.experimental</groupId>
<artifactId>spring-boot-thin-layout</artifactId>
<version>1.0.28.RELEASE</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
Here is my maven build logs,
$ mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.avol.func:springcloud-eh-func >----------------
[INFO] Building Azure Java Functions 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) # springcloud-eh-func ---
[INFO] Deleting C:\Users\padaldl\workspace\projects\Avol-POCs\src\Java\JavaFunAppPOC\springcloud-eh-func\target
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) # springcloud-eh-func ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # springcloud-eh-func ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 10 source files to C:\Users\padaldl\workspace\projects\Avol-POCs\src\Java\JavaFunAppPOC\springcloud-eh-func\target\classes
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) # springcloud-eh-func ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory C:\Users\padaldl\workspace\projects\Avol-POCs\src\Java\JavaFunAppPOC\springcloud-eh-func\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) # springcloud-eh-func ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) # springcloud-eh-func ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-dependency-plugin:3.2.0:copy-dependencies (copy-dependencies) # springcloud-eh-func ---
[INFO] Copying azure-functions-java-library-1.4.2.jar to C:\Users\padaldl\workspace\projects\Avol-POCs\src\Java\JavaFunAppPOC\springcloud-eh-func\target\azure-functions\poc-java-func-apsp\lib\azure-functions-java-library-1.4.2.jar
[INFO]
[INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) # springcloud-eh-func ---
[INFO] Building jar: C:\Users\padaldl\workspace\projects\Avol-POCs\src\Java\JavaFunAppPOC\springcloud-eh-func\target\springcloud-eh-func-1.0.0-SNAPSHOT.jar
[INFO]
[INFO] --- azure-functions-maven-plugin:1.14.3:package (package-functions) # springcloud-eh-func ---
[INFO] Java home : C:/Users/padaldl/workspace/installedsws/zulu-11-azure-jdk_11.52.13-11.0.13-win_x64
[INFO] Artifact compile version : 11
[INFO]
[INFO] Step 1 of 8: Searching for Azure Functions entry points
[INFO] 2 Azure Functions entry point(s) found.
[INFO]
[INFO] Step 2 of 8: Generating Azure Functions configurations
[INFO] Generation done.
[INFO]
[INFO] Step 3 of 8: Validating generated configurations
[INFO] Validation done.
[INFO]
[INFO] Step 4 of 8: Saving host.json
[INFO] Successfully saved to C:\Users\padaldl\workspace\projects\Avol-POCs\src\Java\JavaFunAppPOC\springcloud-eh-func\target\azure-functions\poc-java-func-apsp\host.json
[INFO]
[INFO] Step 5 of 8: Saving local.settings.json
[INFO] Successfully saved to C:\Users\padaldl\workspace\projects\Avol-POCs\src\Java\JavaFunAppPOC\springcloud-eh-func\target\azure-functions\poc-java-func-apsp\local.settings.json
[INFO]
[INFO] Step 6 of 8: Saving configurations to function.json
[INFO] Starting processing function: uppercase
[INFO] Successfully saved to C:\Users\padaldl\workspace\projects\Avol-POCs\\src\Java\JavaFunAppPOC\springcloud-eh-func\target\azure-functions\poc-java-func-apsp\uppercase\function.json
[INFO] Starting processing function: assetSync
[INFO] Successfully saved to C:\Users\padaldl\workspace\projects\Avol-POCs\src\Java\JavaFunAppPOC\springcloud-eh-func\target\azure-functions\poc-java-func-apsp\assetSync\function.json
[INFO]
[INFO] Step 7 of 8: Copying JARs to staging directoryC:\Users\padaldl\workspace\projects\Avol-POCs\src\Java\JavaFunAppPOC\springcloud-eh-func\target\azure-functions\poc-java-func-apsp
[INFO] Copied successfully.
[INFO] Step 8 of 8: Installing function extensions if needed
[INFO] Extension bundle specified, skip install extension
[INFO] Successfully built Azure Functions.
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:copy-resources (copy-resources) # springcloud-eh-func ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 2 resources
[INFO]
[INFO] --- spring-boot-maven-plugin:2.6.3:repackage (repackage) # springcloud-eh-func ---
[INFO] Replacing main artifact with repackaged archive
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 29.790 s
[INFO] Finished at: 2022-02-03T19:39:15+05:30
[INFO] ------------------------------------------------------------------------
Function App works fine in local from IntellIJ IDEA, and as well run through mvn azure-functions:run command.
When I run the jar using java command java -jar <> it fails with error No Class Definition found error.
mvn azure-functions:deploy succeeded without any issue, and am able to see functions created on azure, but when I trigger function it fails with 500 Internal Error.
I suspect function failing in azure due to external dependencies not added to classpath of jar. From the stackoverflow I found similar question here, suggestion is to go with maven assembly plugin, but my question is why should we use Assembly plugin when I am using springboot plugin?
Finally issue got resolved after installing Azure Functions Core Tools version 4.x through MSI installer on windows.
https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=v4%2Cwindows%2Ccsharp%2Cportal%2Cbash#v2
And it looks like azure functions refer /lib folder under staging directory when function triggers, it need not be springboot fat jar.
Following are the code and pom.xml which I'm using
package com.org.test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;
public class HelloWorld {
#Test
public void Hello() throws InterruptedException {
System.out.println("Logging into account");
System.setProperty("webdriver.gecko.driver", "D:\\Study materials\\Setups\\geckodriver.exe");
WebDriver driver=new FirefoxDriver();
driver.get("https://www.google.com");
driver.close();
}
}
And pom.xml is :
<?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.org.test</groupId>
<artifactId>myTestProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>myTestProject</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven
defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
On running the project as Maven Test, I get a BUILD SUCCESS, but no result of the actual test is being displayed. Here is the result :
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< com.org.test:myTestProject >---------------------
[INFO] Building myTestProject 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) # myTestProject ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\Eclipse\myTestProject\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) # myTestProject ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) # myTestProject ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\Eclipse\myTestProject\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) # myTestProject ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) # myTestProject ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.984 s
[INFO] Finished at: 2018-12-30T21:33:57+05:30
[INFO] ------------------------------------------------------------------------
I have tried similar threads on Google,and tried updating my dependencies too. Any help would be appreciated.
Rename the class to include the word 'Test' to be picked up automatically by surefire plugin. Refer this https://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html for more details.
When I try to build the project using
mvn clean package -P dev, it activates the dev profile and performs the build. But when I try with mvn clean install -P dev, it builds all the profiles.
I have more than one profiles in my pom.xml.
<profiles>
<!-- The Configuration of the development profile -->
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<build.profile.id>dev</build.profile.id>
<skip.integration.tests>true</skip.integration.tests>
<skip.unit.tests>false</skip.unit.tests>
</properties>
</profile>
<!-- The Configuration of the integration-test profile -->
<profile>
<id>integration-test</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<build.profile.id>integration-test</build.profile.id>
<skip.integration.tests>false</skip.integration.tests>
<skip.unit.tests>true</skip.unit.tests>
</properties>
</profile>
</profiles>
Also tried with mvn clean install --activate-profiles=dev, but with same results. Even -D option also did not work.
========================Update=====================================
Please find the complete POM here:
<?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.myservice</groupId>
<artifactId>myservicename</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<!-- Below property indicates the pattern of the test suite -->
<runSuite>**/*Test.class</runSuite>
</properties>
<profiles>
<!-- The Configuration of the development profile -->
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<build.profile.id>dev</build.profile.id>
<skip.integration.tests>true</skip.integration.tests>
<skip.unit.tests>false</skip.unit.tests>
</properties>
</profile>
<!-- The Configuration of the integration-test profile -->
<profile>
<id>integration-test</id>
<properties>
<build.profile.id>integration-test</build.profile.id>
<skip.integration.tests>false</skip.integration.tests>
<skip.unit.tests>true</skip.unit.tests>
</properties>
</profile>
</profiles>
<dependencies>
<!-- All Dependencies -->
</dependencies>
<build>
<plugins>
<!-- Adds source and resource directories to build -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<!-- Add a new source directory to our build -->
<execution>
<id>add-integration-test-sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<!-- Configures the source directory of our integration tests -->
<sources>
<source>src/integration-test/java</source>
</sources>
</configuration>
</execution>
<!-- Add a new resource directory to our build -->
<execution>
<id>add-integration-test-resources</id>
<phase>generate-test-resources</phase>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<!-- Configures the resource directory of our integration tests -->
<resources>
<!-- Placeholders that are found from the files located in the configured
resource directories are replaced with the property values found from the
profile specific configuration file. -->
<resource>
<filtering>true</filtering>
<directory>src/integration-test/resources</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- Below plugin ensures the execution of test cases during maven build -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Skips unit tests if the value of skip.unit.tests property is true -->
<skipTests>${skip.unit.tests}</skipTests>
<includes>
<include>${runSuite}</include>
</includes>
<excludes>
<exclude>com.myservice.testsuite.service.*</exclude>
</excludes>
</configuration>
</plugin>
<!-- Runs integration tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18</version>
<executions>
<!-- Invokes both the integration-test and the verify goals of the Failsafe Maven plugin -->
<execution>
<id>integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<!-- Skips integration tests if the value of skip.integration.tests property is true -->
<skipTests>${skip.integration.tests}</skipTests>
<includes>
<include>**/*IntegrationTest.class</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</pluginManagement>
</build>
</project>
And also the console output for mvn clean install -P dev:
c:\path\to\gitrepo\service>mvn clean install -P dev
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building TwelveFactorAnswers 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) # myservicename ---
[INFO] Deleting c:\path\to\gitrepo\service\target
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.9:prepare-agent (jacoco-initialize) # myservicename ---
[INFO]
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # myservicename ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # myservicename ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 16 source files to c:\path\to\gitrepo\service\target\classes
[INFO]
[INFO] --- build-helper-maven-plugin:1.10:add-test-source (add-integration-test-sources) # myservicename ---
[INFO] Test Source directory: c:\path\to\gitrepo\service\src\integration-test\java added.
[INFO]
[INFO] --- build-helper-maven-plugin:1.10:add-test-resource (add-integration-test-resources) # myservicename ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # myservicename ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory c:\path\to\gitrepo\service\src\test\resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # myservicename ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to c:\path\to\gitrepo\service\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) # myservicename ---
[INFO] Surefire report directory: c:\path\to\gitrepo\service\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
||
||
|| All the JUnit Test runs - sample Junit Test Class - <ServiceName>Test.java
||
||
Results :
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.9:check (jacoco-check) # myservicename ---
[INFO] Loading execution data file c:\path\to\gitrepo\service\target\jacoco.exec
[INFO] Analyzed bundle 'myservicename' with 16 classes
[INFO] All coverage checks have been met.
[INFO]
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) # myservicename ---
[INFO] Building jar: c:\path\to\gitrepo\service\target\myservicename-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:1.5.9.RELEASE:repackage (default) # myservicename ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.9:report (jacoco-site) # myservicename ---
[INFO] Loading execution data file c:\path\to\gitrepo\service\target\jacoco.exec
[INFO] Analyzed bundle 'TwelveFactorAnswers' with 16 classes
[INFO]
[INFO] --- maven-failsafe-plugin:2.18:integration-test (default) # myservicename ---
[INFO] Failsafe report directory: c:\path\to\gitrepo\service\target\failsafe-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
||
||
|| All the Integration Test runs - sample Integration Test Class - <ServiceName>IT.java
||
||
Tests run: 2, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-failsafe-plugin:2.18:integration-test (integration-tests) # myservicename ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-failsafe-plugin:2.18:verify (default) # myservicename ---
[INFO] Failsafe report directory: c:\path\to\gitrepo\service\target\failsafe-reports
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:15 min
[INFO] Finished at: 2018-02-16T14:28:05+05:30
[INFO] Final Memory: 38M/269M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.18:verify (default) on project myservicename: There are test failures.
[ERROR]
[ERROR] Please refer to c:\path\to\gitrepo\service\target\failsafe-reports for the individual test results.
[ERROR] -> [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/MojoFailureException
I think I may have have found the reason for the above behavior. Reference
Before explaining my findings, let me clarify few things:
All my Integration Test class are post-fixed with IT (Example: ServiceIT.java)
All the Integration Test related files (sources & resources) are kept in a folder called integartion-tests inside src folder (example: "src/integration-tests/java" & "src/integration-tests/resources")
Now what I've learnt is:
integration-test phase is included in install, verify & deploy goals.
By default, maven considers any class name ending with -IT and inside test or integration-test folder (eventually in test-classes folder) as Integration Test Class.
Now in my support:
If you look closely in the console output I've pasted, you'll find that the integration-test is being executed twice -
Once:
[INFO] --- maven-failsafe-plugin:2.18:integration-test (default) # myservicename ---
[INFO] Failsafe report directory: c:\path\to\gitrepo\service\target\failsafe-reports
Twice:
[INFO] --- maven-failsafe-plugin:2.18:integration-test (integration-tests) # myservicename ---
[INFO] Tests are skipped.
The first time is being executed as default phase (as a part of install goal). The second time it is being skipped, since the dev profile is being activated, in which the integration-test are skipped.
Why am I so sure?
I changed the Integration Test classes from ServiceIT.java to ServiceIntegrationTest.java and updated the plugin accordingly in pom.xml.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18</version>
<executions>
<!-- Invokes both the integration-test and the verify goals of the Failsafe Maven plugin -->
<execution>
<id>integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<!-- Skips integration tests if the value of skip.integration.tests property is true -->
<skipTests>${skip.integration.tests}</skipTests>
<includes>
<include>**/*IntegrationTest.class</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
Now, for maven, there is no default class for Integration Test and the integration-tests profile is not activated. Hence, maven did not find any default integration test to run. And the console output came as:
[INFO] --- maven-failsafe-plugin:2.18:integration-test (default) # twelvefactorquestion ---
[INFO]
[INFO] --- maven-failsafe-plugin:2.18:integration-test (integration-tests) # twelvefactorquestion ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-failsafe-plugin:2.18:verify (default) # twelvefactorquestion ---
[INFO] Failsafe report directory: c:\Work\12Factor\git\twelveFactorQuestion\target\failsafe-reports
[INFO]
[INFO] --- maven-failsafe-plugin:2.18:verify (integration-tests) # twelvefactorquestion ---
[INFO] Tests are skipped.
The maven project example that is given below shows an error in module-info.java in Eclipse Oxygen:
log4j.api cannot be resolved to a module.
If I remove the line
<packaging>pom<packaging>
from pom.xml the error disappears. However, I need to use pom packaging. If I use Java8 without module definitions, the maven part in my real world example works very well. Trying to migrate to Java9 confronted me with this new issue. First I thought I would not correctly reference the log4j dependency. Then I found out that is has something to do with the pom packaging that I need in my multi-module project. I created a minimal example that is given below to allow you to reproduce the error messages in Eclipse.
=>Is this a bug of the M2E plugin (1.8.2.20171007-0217)?
=>If not, how do I have to adapt my pom.xml file to work with Java9?
Related issues:
How to use log4j with maven and java9?
Import of a Java-9-Jigsaw-Maven-Project in Eclipse Oxygen 4.7 does not work
Java 9 Modules and JUnit 4
Can Maven generate the module declaration
Where should I put unit tests when migrating a Java 8 project to Jigsaw
Which module should I require in Java 9 to use JPA?
List of java modules: http://download.java.net/java/jigsaw/docs/api/overview-summary.html
Min example project (my real example is more complex):
pom.xml:
<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>Log4JWithJava9</groupId>
<artifactId>Log4JWithJava9</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<!-- encoding -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<!-- plugin for resource phase -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>resource-execution</id>
<phase>process-resources</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- plugin for compile phase (and test-compile phase) -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<!-- specify current java version here: -->
<source>9</source>
<target>9</target>
</configuration>
<executions>
<execution>
<id>compile-execution</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile-execution</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- ### PACKAGE ### phase -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>package-execution</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
</configuration>
</execution>
</executions>
</plugin>
<!-- plugin for install phase -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<id>install-execution</id>
<phase>install</phase>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- log4j -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.9.1</version>
</dependency>
</dependencies>
</project>
module-info.java
module Log4JWithJava9 {
exports isi.share;
requires javafx.base;
requires log4j.api;
}
Main.java
package isi.share;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class Main {
private static Logger sysLog = LogManager.getLogger(Main.class);
public static void main(String[] args) {
}
}
Output for maven run configuration with clean install:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Log4JWithJava9 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # Log4JWithJava9 ---
[INFO] Deleting D:\EclipseJava\workspace\Log4JWithJava9\target
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (resource-execution) # Log4JWithJava9 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\EclipseJava\workspace\Log4JWithJava9\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (compile-execution) # Log4JWithJava9 ---
[WARNING] ********************************************************************************************************************
[WARNING] * Required filename-based automodules detected. Please don't publish this project to a public artifact repository! *
[WARNING] ********************************************************************************************************************
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to D:\EclipseJava\workspace\Log4JWithJava9\target\classes
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (test-compile-execution) # Log4JWithJava9 ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-jar-plugin:3.0.2:jar (package-execution) # Log4JWithJava9 ---
[INFO] Building jar: D:\EclipseJava\workspace\Log4JWithJava9\target\Log4JWithJava9-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) # Log4JWithJava9 ---
[INFO] Installing D:\EclipseJava\workspace\Log4JWithJava9\pom.xml to C:\Users\eis\.m2\repository\Log4JWithJava9\Log4JWithJava9\0.0.1-SNAPSHOT\Log4JWithJava9-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (install-execution) # Log4JWithJava9 ---
[INFO] Installing D:\EclipseJava\workspace\Log4JWithJava9\pom.xml to C:\Users\eis\.m2\repository\Log4JWithJava9\Log4JWithJava9\0.0.1-SNAPSHOT\Log4JWithJava9-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.520 s
[INFO] Finished at: 2017-11-10T20:41:10+01:00
[INFO] Final Memory: 15M/52M
[INFO] ------------------------------------------------------------------------
Whole Eclipse example project:
https://github.com/stefaneidelloth/java9MavenEclipse
Tools used:
Eclipse for RCP and RAP Developers, Oxygen 1a Release (4.7.1a)
(Including M2E version 1.8.2.20171007-0217)
Java JDK version 9.0.1
I had a maven project that worked fine in Eclipse 3.4.2 before I updated that project.
OS: Windows XP, SP2
Maven: maven-2.2.1
Java: jdk1.6.0_17
Eclipse: 3.4.2
m2e: 0.9.8
When I perform the following from Eclipse:
(1) maven clean, then
(2) maven install;
the installation fails. Here is a partial of the log.
[INFO] Installing C:\DLiao\Archive_Reconciler\R18\app\target\tsi-apex-reconciler-app-1.0.18.jar to C:\Documents and Settings\DLiao\.m2\repository\net\transolutions\apex\tsi-apex-reconciler-app\1.0.18\tsi-apex-reconciler-app-1.0.18.jar
[INFO] ------------------------------------------------------------------------
[INFO] Building Transolutions Apex Reconciler Web Application
[INFO]
[INFO] Id: net.transolutions.apex:tsi-apex-reconciler-web:war:1.0.18
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] No sources to compile
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] No sources to compile
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] [war:war]
[INFO] Packaging webapp
[INFO] Assembling webapp[tsi-apex-reconciler-web] in [C:\DLiao\Archive_Reconciler\R18\web\target\tsi-apex-reconciler-web-1.0.18]
[INFO] Processing war project
[INFO]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] Transolutions Apex Reconciler ......................... SUCCESS [0.672s]
[INFO] Transolutions Apex Reconciler Data Layer .............. SUCCESS [1.672s]
[INFO] Transolutions Apex Reconciler Render Service Client ... SUCCESS [0.188s]
[INFO] Transolutions Apex Reconciler Application Layer ....... SUCCESS [1.250s]
[INFO] Transolutions Apex Reconciler Web Application ......... FAILED [1.718s]
[INFO] ------------------------------------------------------------------------
[ERROR]
*The following mojo encountered an error while executing:
Group-Id: org.apache.maven.plugins
Artifact-Id: maven-war-plugin
Version: 2.1-alpha-1
Mojo: war
brought in via: packaging: war
While building project:
Group-Id: net.transolutions.apex
Artifact-Id: tsi-apex-reconciler-web
Version: 1.0.18
From file: C:\DLiao\Archive_Reconciler\R18\web\pom.xml
Reason: Failed to copy file for artifact[active project artifact:
artifact = net.transolutions.apex:tsi-apex-reconciler-app:jar:1.0.18:compile;
project: MavenProject: net.transolutions.apex:tsi-apex-reconciler-app:1.0.18 # C:\DLiao\Archive_Reconciler\
R18\app\pom.xml]*
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run with the -e flag
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILED
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5 seconds
[INFO] Finished at: Wed Jan 02 14:14:19 CST 2013
[INFO] Final Memory: 3M/20M
[INFO] ------------------------------------------------------------------------
However, if I run
mvn clean install
from DOS command line (Java JDK 1.6.0_17), everything is fine, and the .war fine is deployed under my ~/m2/...
Here is the log file from command line.
[INFO] Installing C:\DLiao\Archive_Reconciler\R18\app\target\tsi-apex-reconciler
-app-1.0.18.jar to C:\Documents and Settings\DLiao\.m2\repository\net\transoluti
ons\apex\tsi-apex-reconciler-app\1.0.18\tsi-apex-reconciler-app-1.0.18.jar
[INFO] ------------------------------------------------------------------------
[INFO] Building Transolutions Apex Reconciler Web Application
[INFO] task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting directory C:\DLiao\Archive_Reconciler\R18\web\target
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] No sources to compile
[INFO] [resources:testResources {execution: default-testResources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\DLiao\Archive_Reconciler\R18\web\s
rc\test\resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] No sources to compile
[INFO] [surefire:test {execution: default-test}]
[INFO] No tests to run.
[INFO] [war:war {execution: default-war}]
[INFO] Packaging webapp
[INFO] Assembling webapp[tsi-apex-reconciler-web] in [C:\DLiao\Archive_Reconcile
r\R18\web\target\tsi-apex-reconciler-web-1.0.18]
[INFO] Processing war project
[INFO] Copying webapp resources[C:\DLiao\Archive_Reconciler\R18\web\src\main\web
app]
[INFO] Webapp assembled in[1110 msecs]
[INFO] Building war: C:\DLiao\Archive_Reconciler\R18\web\target\tsi-apex-reconci
ler-web-1.0.18.war
[INFO] [install:install {execution: default-install}]
[INFO] Installing C:\DLiao\Archive_Reconciler\R18\web\target\tsi-apex-reconciler
-web-1.0.18.war to C:\Documents and Settings\DLiao\.m2\repository\net\transoluti
ons\apex\tsi-apex-reconciler-web\1.0.18\tsi-apex-reconciler-web-1.0.18.war
[INFO]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] Transolutions Apex Reconciler ......................... SUCCESS [1.172s]
[INFO] Transolutions Apex Reconciler Data Layer .............. SUCCESS [2.406s]
[INFO] Transolutions Apex Reconciler Render Service Client ... SUCCESS [0.328s]
[INFO] Transolutions Apex Reconciler Application Layer ....... SUCCESS [3.547s]
[INFO] Transolutions Apex Reconciler Web Application ......... SUCCESS [10.282s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17 seconds
[INFO] Finished at: Wed Jan 02 11:23:10 CST 2013
[INFO] Final Memory: 49M/254M
[INFO] ------------------------------------------------------------------------
Any suggestions, please advise.
Thanks
Dave
The parent POM 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
<reconciler.version>1.0.19</reconciler.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<groupId>net.transolutions.apex</groupId>
<artifactId>tsi-apex-reconciler</artifactId>
<version>1.0.19</version>
<packaging>pom</packaging>
<name>Transolutions Apex Reconciler</name>
<description>Update and reimplementation of the classic reconciler web application.</description>
<modules>
<module>data</module>
<module>app</module>
<module>web</module>
<module>render-service</module>
</modules>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<verbose>true</verbose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Portfolio Snapshot Repository</name>
<url>http://s3.amazonaws.com/maven.springframework.org/snapshot</url>
</repository>
<repository>
<id>maven.org</id>
<name>Maven 2 Repository</name>
<url>http://repo2.maven.org/maven2/</url>
</repository>
<repository>
<id>jboss-maven2</id>
<name>JBoss Maven 2 Repository</name>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id>java.net</id>
<name>Java.net Maven Repository</name>
<url>https://maven-repository.dev.java.net/nonav/repository/</url>
</repository>
</repositories>
</project>
The POM file for my web project, which generates the error message.
<?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">
<parent>
<groupId>net.transolutions.apex</groupId>
<artifactId>tsi-apex-reconciler</artifactId>
<version>1.0.19</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>net.transolutions.apex</groupId>
<artifactId>tsi-apex-reconciler-web</artifactId>
<packaging>war</packaging>
<name>Transolutions Apex Reconciler Web Application</name>
<description>Web application that assembles the data layer and application layer.</description>
<properties>
<icefaces.version>1.8.1</icefaces.version>
</properties>
<dependencies>
<dependency>
<groupId>net.transolutions.apex</groupId>
<artifactId>tsi-apex-reconciler-app</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces</artifactId>
<version>${icefaces.version}</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces-facelets</artifactId>
<version>${icefaces.version}</version>
<exclusions>
<exclusion>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces-comps</artifactId>
<version>${icefaces.version}</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.3.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.9</version>
<configuration>
<contextPath>/reconciler</contextPath>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8080</port>
<maxIdleTime>3600000</maxIdleTime>
</connector>
<systemProperties>
<property>
<name>slf4j</name>
<value>false</value>
</property>
<property>
<name>log4j.configuration</name>
<value>file:${basedir}/src/main/webapp/WEB-INF/classes/log4j.properties</value>
</property>
<property>
<name>catalina.home</name>
<value>${basedir}/target/</value>
</property>
<property>
<name>catalina.base</name>
<value>${basedir}/target/</value>
</property>
</systemProperties>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<url>http://192.168.56.1:8080/manager/text</url>
<server>TomcatServer</server>
<path>/tsi-apex-reconciler-web-1.0.18</path>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>TEST</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<delete
file="${project.build.outputDirectory}/environment.properties" />
<copy file="src/main/resources/environment.test.properties"
tofile="${project.build.outputDirectory}/environment.properties" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>test</classifier>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>PROD</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<delete file="${project.build.outputDirectory}/PROD.jdbc.properties" />
<delete file="${project.build.outputDirectory}/PROD.jdbc.properties" />
<delete file="${project.build.outputDirectory}//TEST.renderer.properties" />
<delete file="${project.build.outputDirectory}//TEST.renderer.properties" />
<delete file="${project.build.outputDirectory}/jdbc.properties" />
<copy file="src/main/resources/PROD.jdbc.properties"
tofile="${project.build.outputDirectory}/jdbc.properties" />
<delete file="${project.build.outputDirectory}/renderer.properties" />
<copy file="src/main/resources/PROD.renderer.properties"
tofile="${project.build.outputDirectory}/renderer.properties" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Hope these will help.
Best,
Dave