Problems to create the jar using mvn and springboot - java

I'm trying to do a rest server with spring-boot but I'm having some problems with the configuration.
My problem it's that if I try to do mvn install it doesn't generate the jar (it doesn't generate nothing in the target). I don't know if I need to do something specific to generate the jar using spring boot or if I'm doing something bad in the pom.xml. I also tried with mvn clean install, mvn clean package and mvn compile.
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>
<groupId>uib.ws.app</groupId>
<artifactId>ws-app</artifactId>
<packaging>pom</packaging>
<version>1.0.0</version>
<name>WS App Project</name>
<properties>
<!-- Data source properties -->
<dataSource.user>uibRT</dataSource.user>
<dataSource.password>uibRT</dataSource.password>
<dataSource.jndiName>jdbc/AppRecipe</dataSource.jndiName>
<testDataSource.user>${dataSource.user}</testDataSource.user>
<testDataSource.password>${dataSource.password}</testDataSource.password>
<!-- Hibernate properties -->
<hibernate.show_sql>true</hibernate.show_sql>
<hibernate.format_sql>true</hibernate.format_sql>
<hibernate.use_sql_comments>true</hibernate.use_sql_comments>
<!-- Encoding -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Package versions -->
<slf4j.version>1.7.21</slf4j.version>
<javassist.version>3.21.0-GA</javassist.version>
<cglib.version>3.2.3</cglib.version>
<hibernate.version>5.2.7.Final</hibernate.version>
<spring.version>4.3.6.RELEASE</spring.version>
<springboot.version>1.5.8.RELEASE</springboot.version>
<jayway.version>2.0.0</jayway.version>
<commonsDbcp.version>2.1.1</commonsDbcp.version>
<junit.version>4.12</junit.version>
<servletApi.version>2.3</servletApi.version>
<httpclient.version>4.5.2</httpclient.version>
<jdom2.version>2.0.6</jdom2.version>
<java.version>1.8</java.version>
<!-- JDBC driver properties -->
<jdbcDriver.groupId>org.postgresql</jdbcDriver.groupId>
<jdbcDriver.artifactId>postgresql</jdbcDriver.artifactId>
<jdbcDriver.version>9.4-1206-jdbc42</jdbcDriver.version>
<jdbcDriver.className>org.postgresql.Driver</jdbcDriver.className>
<!-- Data source properties -->
<dataSource.baseUrl>jdbc:postgresql://localhost:5432/AppRecipe</dataSource.baseUrl>
<dataSource.url>${dataSource.baseUrl}?useSSL=false</dataSource.url>
<testDataSource.url>${dataSource.baseUrl}Test</testDataSource.url>
<dataSource.createTablesScript>1-CreateTables.sql</dataSource.createTablesScript>
<dataSource.createDataScript>2-CreateData.sql</dataSource.createDataScript>
<!-- Plugin versions -->
<mavenCompilerPlugin.version>3.5.1</mavenCompilerPlugin.version>
<mavenResourcesPlugin.version>3.0.1</mavenResourcesPlugin.version>
<sqlMavenPlugin.version>1.5</sqlMavenPlugin.version>
<mavenAssemblyPlugin.version>2.6</mavenAssemblyPlugin.version>
<pojo-modelutil.version>2.3.1</pojo-modelutil.version>
<jettyMavenPlugin>9.3.10.v20160621</jettyMavenPlugin>
</properties>
<!-- ========================================================== -->
<!-- Profiles -->
<profiles>
<profile>
<id>win</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<properties>
<tool.wsgen>${java.home}/../bin/wsgen.exe</tool.wsgen>
<tool.wsimport>${java.home}/../bin/wsimport.exe</tool.wsimport>
</properties>
</profile>
<profile>
<id>nix</id>
<activation>
<os>
<family>!windows</family>
</os>
</activation>
<properties>
<tool.wsgen>${java.home}/../bin/wsgen</tool.wsgen>
<tool.wsimport>${java.home}/../bin/wsimport</tool.wsimport>
</properties>
</profile>
<profile>
<id>postgresql</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!-- JDBC driver properties -->
<jdbcDriver.groupId>${jdbcDriver.groupId}</jdbcDriver.groupId>
<jdbcDriver.artifactId>${jdbcDriver.artifactId}</jdbcDriver.artifactId>
<jdbcDriver.version>${jdbcDriver.version}</jdbcDriver.version>
<jdbcDriver.className>${jdbcDriver.className}</jdbcDriver.className>
<!-- Data source properties -->
<dataSource.baseUrl>${dataSource.baseUrl}</dataSource.baseUrl>
<dataSource.url>${dataSource.url}</dataSource.url>
<testDataSource.url>${testDataSource.url}</testDataSource.url>
<dataSource.createTablesScript>${dataSource.createTablesScript}</dataSource.createTablesScript>
<dataSource.createDataScript>${dataSource.createDataScript}</dataSource.createDataScript>
<!-- Hibernate properties -->
<hibernate.dialect>org.hibernate.dialect.PostgreSQlDialect</hibernate.dialect>
</properties>
</profile>
</profiles>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
<relativePath></relativePath>
</parent>
<dependencies>
<!-- JDBC driver -->
<dependency>
<groupId>${jdbcDriver.groupId}</groupId>
<artifactId>${jdbcDriver.artifactId}</artifactId>
<version>${jdbcDriver.version}</version>
<scope>test</scope>
</dependency>
<!-- Commons DBCP - JDBC Connection Pool -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>${commonsDbcp.version}</version>
<scope>test</scope>
</dependency>
<!-- SLF4J (required by Hibernate) -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<!-- Javassist (required by Hibernate) -->
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>${javassist.version}</version>
<scope>runtime</scope>
</dependency>
<!-- CGLIB (required by Spring) -->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>${cglib.version}</version>
<scope>runtime</scope>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<!-- JUnit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<!-- SpringBoot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- =============================================================== -->
<!-- Filtering -->
<resources>
<!-- Apply filtering to files matching the following expressions
in src/main/resources. -->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>spring-config.xml</include>
<include>hibernate-config.xml</include>
</includes>
</resource>
<!-- Continue considering resources the files in src/main/resources,
but without applying filtering. -->
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<testResources>
<!-- Continue considering resources the files in src/test/resources,
but without applying filtering. -->
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
<pluginManagement>
<plugins>
<!--
Added to avoid problems with the maven plugin for
eclipse
-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<versionRange>${sqlMavenPlugin.version}</versionRange>
<goals>
<goal>execute</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- ========================================================== -->
<!-- Compiler configuration -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${mavenCompilerPlugin.version}</version>
<configuration>
<verbose>true</verbose>
<source>1.8</source>
<target>1.8</target>
<encoding>${project.build.sourceEncoding}</encoding>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<!-- ========================================================== -->
<!-- Resources plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${mavenResourcesPlugin.version}</version>
</plugin>
<!-- ========================================================== -->
<!-- Exec plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
</plugin>
<!-- ========================================================== -->
<!-- Setting SQL Plugin -->
<!-- - Configuration specifies onError="continue" since SQL scripts
try to drop tables before creating them (which causes errors if such tables
do not exist yet). - Configuartion specifies autocommit="true" since some
drivers (e.g the PostgreSQL JDBC 2 driver) do not commit changes if some
error ocurrs. -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>${sqlMavenPlugin.version}</version>
<dependencies>
<dependency>
<groupId>${jdbcDriver.groupId}</groupId>
<artifactId>${jdbcDriver.artifactId}</artifactId>
<version>${jdbcDriver.version}</version>
</dependency>
</dependencies>
<configuration>
<driver>${jdbcDriver.className}</driver>
<url>${dataSource.url}</url>
<username>${dataSource.user}</username>
<password>${dataSource.password}</password>
<autocommit>true</autocommit>
<onError>continue</onError>
<orderFile>ascending</orderFile>
<fileset>
<basedir>${basedir}</basedir>
<includes>
<include>src/sql/${dataSource.createTablesScript}</include>
<include>src/sql/${dataSource.createDataScript}</include>
</includes>
</fileset>
</configuration>
<executions>
<execution>
<id>create-tables-for-testing</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<driver>${jdbcDriver.className}</driver>
<url>${testDataSource.url}</url>
<username>${testDataSource.user}</username>
<password>${testDataSource.password}</password>
<autocommit>true</autocommit>
<onError>continue</onError>
<fileset>
<basedir>${basedir}</basedir>
<includes>
<include>
src/sql/${dataSource.createTablesScript}
</include>
</includes>
</fileset>
</configuration>
</execution>
</executions>
</plugin>
<!-- ========================================================== -->
<!-- Assembly configuration -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${mavenAssemblyPlugin.version}</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/src.xml</descriptor>
</descriptors>
</configuration>
</plugin>
<!-- ========================================================== -->
<!-- Jetty configuration -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jettyMavenPlugin}</version>
<configuration>
<httpConnector>
<port>9090</port>
</httpConnector>
<webAppConfig>
<contextPath>/${project.artifactId}</contextPath>
<jettyEnvXml>target/jetty/jetty-env.xml</jettyEnvXml>
</webAppConfig>
<reload>manual</reload>
</configuration>
<dependencies>
<dependency>
<groupId>${jdbcDriver.groupId}</groupId>
<artifactId>${jdbcDriver.artifactId}</artifactId>
<version>${jdbcDriver.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
<!-- ========================================================== -->
<!-- Springboot plugin -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
</project>
And here is my src.xml in the assembly folder:
<?xml version="1.0" encoding="UTF-8"?>
<assembly>
<id>src</id>
<formats>
<format>zip</format>
<format>tar.gz</format>
<format>tar.bz2</format>
</formats>
<fileSets>
<fileSet>
<includes>
<include>**/*</include>
</includes>
<excludes>
<exclude>**/.project</exclude>
<exclude>**/.classpath</exclude>
<exclude>**/.settings/**</exclude>
<exclude>**/target/**</exclude>
<exclude>**/META-INF/**</exclude> <!-- Created by m2eclipse -->
<exclude>.git/**</exclude>
<exclude>.gitignore</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>
Here is the structure of my project: Structure

With Spring Boot you can create runnable jars which you can run via cmd.
The problem is you aren't telling Maven to create a jar!
Would you try changing your packaging inside your pom from pom to jar, like so:
<packaging>jar</packaging>
EDIT:
If your pom is missing a <packaging> tag, maven's default is jar.

Related

Fail to generate allure-results directory based on JUnit 4

I failed to generate the directory allure-results in my project. I have tried many methods from google(create src/test/resources/allure.properties, set <resultsDirectory>${project.build.directory}/allure-results</resultsDirectory> in pom.xml, etc.), but all setting seems not to take effect. I also failed to redirect the result to other directories. It always said "[ERROR] Directory <project_path>/target/allure-results not found".
My command to generate report is
mvn clean test -Dtest=aaaTestClass io.qameta.allure:allure-maven:report
My pom.xml is like:
<?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>***</groupId>
<artifactId>***</artifactId>
<version>***</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
</parent>
<properties>
...
<aspectj.version>1.9.9</aspectj.version>
<allure.version>2.13.9</allure.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Greenwich.SR1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
...
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.6.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-engine</artifactId>
<version>1.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-commons</artifactId>
<version>1.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
<scope>test</scope>
</dependency>
...
<!-- test report dependencies -->
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-junit4</artifactId>
<version>${allure.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<configuration>
<classifier>runnable</classifier>
<attach>false</attach>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<!--
<version>${maven.jar.version}</version>
-->
<version>2.4</version>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-surefire-plugin</artifactId>-->
<!-- <version>2.19.1</version>-->
<!-- <configuration>-->
<!-- <testFailureIgnore>true</testFailureIgnore>-->
<!-- <argLine>-->
<!-- -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"-->
<!-- </argLine>-->
<!-- <systemProperties>-->
<!-- <property>-->
<!-- <name>allure.results.directory</name>-->
<!-- <value>${project.build.directory}/allure-results</value>-->
<!-- </property>-->
<!-- </systemProperties>-->
<!-- <properties>-->
<!-- <property>-->
<!-- <name>listener</name>-->
<!-- <value>io.qameta.allure.junit4.AllureJunit4</value>-->
<!-- </property>-->
<!-- </properties>-->
<!-- </configuration>-->
<!-- <dependencies>-->
<!-- <dependency>-->
<!-- <groupId>org.aspectj</groupId>-->
<!-- <artifactId>aspectjweaver</artifactId>-->
<!-- <version>${aspectj.version}</version>-->
<!-- </dependency>-->
<!-- </dependencies>-->
<!-- </plugin>-->
<!-- <plugin>-->
<!-- <groupId>io.qameta.allure</groupId>-->
<!-- <artifactId>allure-maven</artifactId>-->
<!-- <version>2.10.0</version>-->
<!-- <configuration>-->
<!-- <reportVersion>${allure.version}</reportVersion>-->
<!-- <resultsDirectory>${project.build.directory}/allure-results</resultsDirectory>-->
<!-- <allureDownloadUrl>-->
<!-- https://***/io/qameta/allure/allure-commandline/2.18.1/allure-commandline-2.18.1.zip-->
<!-- </allureDownloadUrl>-->
<!-- </configuration>-->
<!-- </plugin>-->
</plugins>
</build>
<profiles>
<profile>
<id>aaa</id>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<includes>
<include>**/aaatest/*Test</include>
</includes>
<testFailureIgnore>true</testFailureIgnore>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
<properties>
<property>
<name>listener</name>
<value>io.qameta.allure.junit4.AllureJunit4</value>
</property>
</properties>
<systemPropertyVariables>
<allure.results.directory>${project.build.directory}/allure-results</allure.results.directory>
</systemPropertyVariables>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.11.2</version>
<configuration>
<reportVersion>${allure.version}</reportVersion>
<resultsDirectory>${project.build.directory}/allure-results</resultsDirectory>
<allureDownloadUrl>
https://***/io/qameta/allure/allure-commandline/2.18.1/allure-commandline-2.18.1.zip
</allureDownloadUrl>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>bbb</id>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<includes>
<include>**/bbbtest/*Test</include>
</includes>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
The profile setup seems to be a mixture of Junit4 and JUnit5 configuration for Allure reports. Clean this up first, suggest the below for the first profile based on Junit4:
<profiles>
<profile>
<id>aaa</id>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<includes>
<include>**/aaatest/*Test</include>
</includes>
<testFailureIgnore>true</testFailureIgnore>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
<properties>
<property>
<name>listener</name>
<value>io.qameta.allure.junit4.AllureJunit4</value>
</property>
</properties>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
The configuration should generate the results in the default location of <project_path>/target/allure-results
There also is an issue with the mvn command. The first part of the command is mvn clean it will ensure that any existing target directory is removed before the next part of the command, in this case test.
The command as noted above is a two part command, the second effectively being mvn io.qameta.allure:allure-maven:report.
In summary, both mvn commands are being executed at the same time:
one that removes the target directory(mvn clean) or awaiting to create it (mvn test)
second that wants to generate a report in the target directory that does not exist or awaiting to be created by the above
Also to note that the second part of the command could also cause an exception even if the target directory did exist. As no allure results would have been created as the mvn test still needs to execute a test result / complete the test execution suite
The requirement here is a mvn cli command that will run both commands consequentially, use the && syntax like this:
mvn clean test -Dtest=aaaTestClass && mvn allure:report
This will run the test suite to completion and then generate the report
The report should generated in the following location:
<project_path>/target/site/allure-maven/index.html
In my project, I just add this dependency to fix this issue:
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit4</artifactId>
<version>3.0.0-M7</version>
</dependency>

Could not resolve version conflict among [io.cucumber:cucumber-core:jar:7.3.4 -> io.cucumber:messages:jar:18.0.0

I have included all the jars in the POM file as follows:
<?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.gorilla</groupId>
<artifactId>tomcat</artifactId>
<version>0.0.1</version>
<name>tomcat</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>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>7.3.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>7.3.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>7.3.4</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-jvm-deps -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.6</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/net.masterthought/cucumber-reporting -->
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<version>5.7.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/gherkin -->
<!-- https://mvnrepository.com/artifact/io.cucumber/gherkin -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>gherkin</artifactId>
<version>22.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-gherkin -->
<!-- https://mvnrepository.com/artifact/org.mockito/mockito-all -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/cobertura/cobertura -->
<dependency>
<groupId>cobertura</groupId>
<artifactId>cobertura</artifactId>
<version>1.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core -->
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.1.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3.1</version>
<executions>
<execution>
<id>enforce</id>
<configuration>
<rules>
<DependencyConvergence />
</rules>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- 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-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>
<profiles>
<profile>
<id>logintest</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testsuite.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
but there is a version conflict in the POM file and an error in the dependency hierarchy
snapshot of the eclipse ide when there is an error
I have forced updated more than 10 times and reinstalled eclipse multiple times and included the files and folders again but in vain. I have used maven enforcer as well as suggested by someone on the stack overflow itself but that too could not resolve the issue. Cucumber setup is a big headache instead a person can just write the document in plain english and use selenium to automate without cucumber integration!!!! Kindly tell how to resolve it
You can upgrade version of Gherkin:
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>gherkin</artifactId>
<version>23.0.0</version>
</dependency>

How to deploy Java Web app on Azure DevOps

I am trying to deploy Java Web app developed in spring boot to Azure Devops. pom.xml and Build Pipeline is also running fine but somehow its not pointing to any internal file structure. We have our classes services and controllers at location /src/main/java/com/corrigo but
when adding these in pom.xml its still redirecting to Azures welcome developers page and we have our main starter file at location /src/main/java/com/corrigo/demo/CorrigoModoApplication.java
I think the issue resides in pom.xml. can any one please help me to understand where am I going wrong?
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 https://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.2.4.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>corrigoModo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>corrigoModo</name>
<description>corrigo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<!-- <src.dir>src/main/java</src.dir> -->
</properties>
<build>
<sourceDirectory>${project.basedir}/src/main/java/com/corrigo</sourceDirectory>
<!--<sourceDirectory>${src.dir}</sourceDirectory> -->
<!-- <profiles>
<profile>
<id>development</id>
<properties>
<src.dir>${project.build.directory}/com/corrigo</src.dir>
</properties>
</profile>
</profiles> -->
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<skipTests>false</skipTests>
<testFailureIgnore>true</testFailureIgnore>
<forkMode>once</forkMode>
</configuration>
</plugin>
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-webapp-maven-plugin</artifactId>
<version>1.9.1</version>
<configuration>
<schemaVersion>V2</schemaVersion>
<resourceGroup>***************</resourceGroup>
<appName>********</appName>
<region>********</region>
<pricingTier>**</pricingTier>
<runtime>
<os>linux</os>
<javaVersion>jre8</javaVersion>
<webContainer>jre8</webContainer>
</runtime>
<!-- Begin of App Settings -->
<appSettings>
<property>
<name>corrigoModo</name>
<value>-Dserver.port=80</value>
</property>
</appSettings>
<!-- End of App Settings -->
<deployment>
<resources>
<resource>
<directory>${project.basedir}/target</directory>
<includes>
<include>*.jar</include>
</includes>
</resource>
</resources>
</deployment>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<!-- <version>${maven-surefire-plugin.version}</version> -->
<configuration>
<!-- Force alphabetical order to have a reproducible build -->
<runOrder>alphabetical</runOrder>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.14.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<generatePackage>com.medium.article</generatePackage>
<schemaDirectory>src/main/resources/wsdl</schemaDirectory>
<schemaIncludes>
<schemaInclude>*.wsdl</schemaInclude>
</schemaIncludes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.3</version>
</dependency>
<!-- <dependency> <groupId>org.springframework.ws</groupId> <artifactId>spring-ws-security</artifactId>
</dependency> -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.4.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
<!-- <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-jwt</artifactId>
</dependency> -->
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>adal4j</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>oauth2-oidc-sdk</artifactId>
<version>4.5</version>
</dependency>
<!-- <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-config</artifactId>
</dependency> -->
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
<!-- <dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version> <type>maven-plugin</type> </dependency> -->
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20190722</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.6</version>
</dependency>
<dependency>
<groupId>wss4j</groupId>
<artifactId>wss4j</artifactId>
<version>1.5.1</version>
</dependency>
</dependencies>
Build Pipeline is also running fine but somehow its not pointing to any internal file structure.
Since the build/deploy succeed, you should first check if the APP already deploy in Azure.
If there is, you may use the wrong url, so it always redirect to the Azures welcome developers page.
Navigate to the Web App and select the URL from the overview blade. Add /[yourappname] context to the URL. For instance - http://myshuttle1.azurewebsites.net/myshuttledev
More details take a look at this blog-- Deploying a Java-based Tomcat application to Azure

NamingException: Cannot create resource instance with Jackrabbit in Tomcat

I have deployed Jackrabbit in Tomcat 7 using the model 2 (Shared J2EE Resource), but when I try to acces the repository I get the NamingException exception.
javax.naming.NamingException: Cannot create resource instance
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:144)
at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.apache.naming.NamingContext.lookup(NamingContext.java:830)
at org.apache.naming.NamingContext.lookup(NamingContext.java:167)
My code is:
InitialContext context = new InitialContext();
Context environment = (Context) context.lookup("java:comp/env");
// The exception is thrown in this line
Repository repository = (Repository) environment.lookup("jcr/repository");
I added this resource as a GlobalNamingResource in my Tomcat server.xml:
<Resource name="jcr/globalRepository"
auth="Container"
type="javax.jcr.Repository"
factory="org.apache.jackrabbit.core.jndi.BindableRepositoryFactory"
configFilePath="C:\Users\vgomez\repository.xml"
repHomeDir="C:\Users\vgomez\repository"/>
In context.xml I added the ResourceLink:
<ResourceLink
name="jcr/repository"
global="jcr/globalRepository"
type="javax.jcr.Repository"/>
And the web.xml of my web app is:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>Archetype Created Web Application</display-name>
<resource-ref>
<description>JCR Repository</description>
<res-ref-name>jcr/repository</res-ref-name>
<res-type>javax.jcr.Repository</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
Edit: This problem appears when the web app uses Vaadin. If the web app uses jsf for example this configuration works.
I found the problem. I think I didn't have all the dependencies needed. For a Vaadin project created using the comand given in the Book of Vaadin this is the 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>
<groupId>com.example</groupId>
<artifactId>jackrabbitVaadin</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>jackrabbitVaadin</name>
<properties>
<vaadin.version>7.5.9</vaadin.version>
<vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
<jetty.plugin.version>9.2.3.v20140905</jetty.plugin.version>
<project.source.version>1.7</project.source.version>
<project.target.version>1.7</project.target.version>
<project.encoding>UTF-8</project.encoding>
</properties>
<repositories>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
<repository>
<id>vaadin-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<version>${vaadin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>5.0.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-push</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-core</artifactId>
<version>2.8.1</version>
<scope></scope>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-jcr-rmi</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-jcr-server</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-webapp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.5.0</version>
</dependency>
<!-- Needed when using the widgetset optimizer (custom ConnectorBundleLoaderFactory).
For widgetset compilation, vaadin-client-compiler is automatically added
on the compilation classpath by vaadin-maven-plugin so normally there is
no need for an explicit dependency. -->
<!-- <dependency> <groupId>com.vaadin</groupId> <artifactId>vaadin-client-compiler</artifactId>
<scope>provided</scope> </dependency> -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<encoding>${project.encoding}</encoding>
<source>${project.source.version}</source>
<target>${project.target.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>${project.encoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<!-- Exclude some unnecessary files generated by the GWT compiler. -->
<packagingExcludes>WEB-INF/classes/VAADIN/gwt-unitCache/**,
WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes>
</configuration>
</plugin>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.plugin.version}</version>
<configuration>
<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
<webappDirectory>${basedir}/target/classes/VAADIN/widgetsets</webappDirectory>
<draftCompile>false</draftCompile>
<compileReport>false</compileReport>
<style>OBF</style>
<strict>true</strict>
</configuration>
<executions>
<execution>
<goals>
<goal>update-theme</goal>
<goal>update-widgetset</goal>
<goal>compile</goal>
<!-- disabled by default to use on-the-fly theme compilation -->
<!-- <goal>compile-theme</goal> -->
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.6.1</version>
<!-- Clean up also any pre-compiled themes -->
<configuration>
<filesets>
<fileset>
<directory>src/main/webapp/VAADIN/themes</directory>
<includes>
<include>**/styles.css</include>
<include>**/styles.scss.cache</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<!-- The Jetty plugin allows us to easily test the development build by
running jetty:run on the command line. -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.plugin.version}</version>
<configuration>
<scanIntervalSeconds>2</scanIntervalSeconds>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<!-- TODO Remove when http://dev.vaadin.com/ticket/14924 is resolved -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.vaadin</groupId>
<artifactId>
vaadin-maven-plugin
</artifactId>
<versionRange>[7.1.11,)</versionRange>
<goals>
<goal>resources</goal>
<goal>update-widgetset</goal>
<goal>compile</goal>
<goal>compile-theme</goal>
<goal>update-theme</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

vaadin & spring boot: compiled widgetset is missed in jar package

I've implemented a web application with Vaadin running with spring boot. Maven is used to build the executable jar package. This is running very well.
But now I have added a custom widgetset... just a renderer to be able to use font awesome labeled buttons inside a grid (https://vaadin.com/forum/#!/thread/9225584/10109123).
On the maven build process I can see that the widgetset will be compiled. I expect the compiled widgetset in the folder VAADIN/widgetsets/, but but it's missed in the jar package.
If I change the packaging informatmation in the pom.xml to "war", the widgetset will be copied in the package.
any ideas how I can copy the compiled widgetset into the jar??
this 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>
<groupId>de.myCompany.app</groupId>
<artifactId>web-ui</artifactId>
<version>1.1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Web-UI</name>
<description>Web UI</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.1.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<aspectj.skip>false</aspectj.skip>
<jgitflow.version>1.0-m5.1</jgitflow.version>
<!-- dependencies version -->
<vaadin.version>7.5.4</vaadin.version>
<app.version>2.3.0-SNAPSHOT</app.version>
<jason.version>1.4.0-SNAPSHOT</jason.version>
<!-- application.properties -->
<server.port>8085</server.port>
</properties>
<scm>
<connection>scm:git:user3#service1.sb.intranet.de:WebUI.git</connection>
<developerConnection>scm:git:user3#service1.sb.intranet.de:WebUI.git</developerConnection>
<tag>HEAD</tag>
</scm>
<distributionManagement>
<repository>
<id>nexus</id>
<name>Internal Releases</name>
<url>https://nexus.sb.intranet.de/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus</id>
<name>Internal Snapshots</name>
<url>https://nexus.sb.intranet.de/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<version>${vaadin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- Ensure the widgetset directory is cleaned properly -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.6.1</version>
<configuration>
<filesets>
<fileset>
<!-- Clean-up widgetset required for "inplace" compilation -->
<directory>${basedir}/src/main/webapp/VAADIN/widgetsets</directory>
</fileset>
<fileset>
<!-- Clean-up gwt cache -->
<directory>${basedir}/src/main/webapp/VAADIN/gwt-unitCache</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
<configuration>
<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
<webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets</webappDirectory>
<hostedWebapp>${basedir}/src/main/webapp/VAADIN/widgetsets</hostedWebapp>
<noServer>true</noServer>
<persistentunitcachedir>${basedir}/target/tmp/gwt-unitCache</persistentunitcachedir>
<compileReport>true</compileReport>
<strict>true</strict>
<runTarget>http://localhost:${server.port}/</runTarget>
</configuration>
<executions>
<execution>
<configuration>
<!-- no specified modules; the plugin will find them automatically-->
</configuration>
<goals>
<!--goal>clean</goal>
<goal>resources</goal>
<goal>update-theme</goal>
<goal>update-widgetset</goal>
<goal>compile-theme</goal>
<goal>compile</goal-->
<goal>resources</goal>
<goal>update-widgetset</goal>
<goal>compile</goal>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<tags>
<tag>
<name>company</name>
<placement>a</placement>
<head>Company:</head>
</tag>
<tag>
<name>date</name>
<placement>a</placement>
<head>Creation:</head>
</tag>
</tags>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
<plugin>
<groupId>external.atlassian.jgitflow</groupId>
<artifactId>jgitflow-maven-plugin</artifactId>
<version>${jgitflow.version}</version>
<configuration>
<allowSnapshots>true</allowSnapshots>
<flowInitContext>
<masterBranchName>master</masterBranchName>
<developBranchName>develop</developBranchName>
<releaseBranchPrefix>release-</releaseBranchPrefix>
<hotfixBranchPrefix>hotfix-</hotfixBranchPrefix>
<versionTagPrefix>V</versionTagPrefix>
</flowInitContext>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/webapp</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.scss</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>platforms.json</include>
</includes>
<targetPath>${project.build.directory}/config</targetPath>
<filtering>true</filtering>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>org.vaadin.spring</groupId>
<artifactId>spring-boot-vaadin</artifactId>
<version>0.0.3</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiler</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${project.parent.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>de.myCompany.app</groupId>
<artifactId>generic-agent-control-common</artifactId>
<version>${app.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>de.myCompany.app</groupId>
<artifactId>control-client</artifactId>
<version>1.5.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>de.myCompany.app</groupId>
<artifactId>control-json</artifactId>
<version>${app.version}</version>
</dependency>
</dependencies>
<profiles>
<profile>
<!--This profile setup logging level to dump only errors out. To
contribute with this mechanism the placeholders "${logger.level}" and "${logger.app.level}"
must be used inside the lockback.xml file or "application.properties" for level definitions
instead of fix level definitions like "info", "debug",.. -->
<id>quiet</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<logger.level>ERROR</logger.level>
<logger.app.level>WARN</logger.app.level>
<surefire.reportFormat>plain</surefire.reportFormat>
<surefire.printSummary>true</surefire.printSummary>
<surefire.useFile>true</surefire.useFile>
</properties>
</profile>
<profile>
<!-- This profile setup logging level to dump detailed informations.
See profile "quietTest" above for more details -->
<id>verbose</id>
<properties>
<logger.level>DEBUG</logger.level>
<logger.app.level>TRACE</logger.app.level>
<surefire.reportFormat>plain</surefire.reportFormat>
<surefire.printSummary>true</surefire.printSummary>
<surefire.useFile>false</surefire.useFile>
</properties>
</profile>
<profile>
<!--+ This profile setup logging level to dump detailed informations.
See profile "quietTest" above for more details + -->
<id>info</id>
<activation>
<property>
<name>verboseTest</name>
</property>
</activation>
<properties>
<logger.level>WARN</logger.level>
<logger.app.level>INFO</logger.app.level>
<surefire.reportFormat>plain</surefire.reportFormat>
<surefire.printSummary>true</surefire.printSummary>
<surefire.useFile>false</surefire.useFile>
</properties>
</profile>
</profiles>
#morfic thank you for your inspiration. :-)
this is my solution and it works very well! (also in the Netbeans IDE with Vaadin plugin):
I set the execution phase of the vaadin maven plugin to 'compile'
I added an additional maven resource plugin with execution phase 'process-classes'
this is my pom:
<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.myCompany.app</groupId>
<artifactId>web-ui</artifactId>
<version>1.1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Web-UI</name>
<description>Web UI</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.1.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<aspectj.skip>false</aspectj.skip>
<jgitflow.version>1.0-m5.1</jgitflow.version>
<!-- dependencies version -->
<vaadin.version>7.5.4</vaadin.version>
<app.version>2.3.0-SNAPSHOT</app.version>
<jason.version>1.4.0-SNAPSHOT</jason.version>
<!-- application.properties -->
<server.port>8085</server.port>
</properties>
<scm>
<connection>scm:git:user3#service1.sb.intranet.de:WebUI.git</connection>
<developerConnection>scm:git:user3#service1.sb.intranet.de:WebUI.git</developerConnection>
<tag>HEAD</tag>
</scm>
<distributionManagement>
<repository>
<id>nexus</id>
<name>Internal Releases</name>
<url>https://nexus.sb.intranet.de/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus</id>
<name>Internal Snapshots</name>
<url>https://nexus.sb.intranet.de/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<version>${vaadin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- Ensure the widgetset directory is cleaned properly -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.6.1</version>
<configuration>
<filesets>
<fileset>
<!-- Clean-up widgetset required for "inplace" compilation -->
<directory>${basedir}/src/main/webapp/VAADIN/widgetsets</directory>
</fileset>
<fileset>
<!-- Clean-up gwt cache -->
<directory>${basedir}/src/main/webapp/VAADIN/gwt-unitCache</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
<configuration>
<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
<webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets</webappDirectory>
<hostedWebapp>${basedir}/src/main/webapp/VAADIN/widgetsets</hostedWebapp>
<noServer>true</noServer>
<persistentunitcachedir>${basedir}/target/tmp/gwt-unitCache</persistentunitcachedir>
<compileReport>true</compileReport>
<strict>true</strict>
<runTarget>http://localhost:${server.port}/</runTarget>
</configuration>
<executions>
<execution>
<configuration>
<!-- no specified modules; the plugin will find them automatically-->
</configuration>
<phase>compile</phase>
<goals>
<goal>clean</goal>
<goal>resources</goal>
<goal>update-theme</goal>
<goal>update-widgetset</goal>
<goal>compile-theme</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<tags>
<tag>
<name>company</name>
<placement>a</placement>
<head>Company:</head>
</tag>
<tag>
<name>date</name>
<placement>a</placement>
<head>Creation:</head>
</tag>
</tags>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>process-classes</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/classes</outputDirectory>
<resources>
<resource>
<directory>src/main/webapp</directory>
<excludes>
<exclude>**/*.scss</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>external.atlassian.jgitflow</groupId>
<artifactId>jgitflow-maven-plugin</artifactId>
<version>${jgitflow.version}</version>
<configuration>
<allowSnapshots>true</allowSnapshots>
<flowInitContext>
<masterBranchName>master</masterBranchName>
<developBranchName>develop</developBranchName>
<releaseBranchPrefix>release-</releaseBranchPrefix>
<hotfixBranchPrefix>hotfix-</hotfixBranchPrefix>
<versionTagPrefix>V</versionTagPrefix>
</flowInitContext>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>platforms.json</include>
</includes>
<targetPath>${project.build.directory}/config</targetPath>
<filtering>true</filtering>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>org.vaadin.spring</groupId>
<artifactId>spring-boot-vaadin</artifactId>
<version>0.0.3</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiler</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${project.parent.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>de.myCompany.app</groupId>
<artifactId>control-common</artifactId>
<version>${app.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>de.myCompany.app</groupId>
<artifactId>control-client</artifactId>
<version>1.5.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>de.myCompany.app</groupId>
<artifactId>generic-agent-control-json</artifactId>
<version>${app.version}</version>
</dependency>
</dependencies>
<profiles>
<profile>
<!--This profile setup logging level to dump only errors out. To
contribute with this mechanism the placeholders "${logger.level}" and "${logger.app.level}"
must be used inside the lockback.xml file or "application.properties" for level definitions
instead of fix level definitions like "info", "debug",.. -->
<id>quiet</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<logger.level>ERROR</logger.level>
<logger.app.level>WARN</logger.app.level>
<surefire.reportFormat>plain</surefire.reportFormat>
<surefire.printSummary>true</surefire.printSummary>
<surefire.useFile>true</surefire.useFile>
</properties>
</profile>
<profile>
<!-- This profile setup logging level to dump detailed informations.
See profile "quietTest" above for more details -->
<id>verbose</id>
<properties>
<logger.level>DEBUG</logger.level>
<logger.app.level>TRACE</logger.app.level>
<surefire.reportFormat>plain</surefire.reportFormat>
<surefire.printSummary>true</surefire.printSummary>
<surefire.useFile>false</surefire.useFile>
</properties>
</profile>
<profile>
<!--+ This profile setup logging level to dump detailed informations.
See profile "quietTest" above for more details + -->
<id>info</id>
<activation>
<property>
<name>verboseTest</name>
</property>
</activation>
<properties>
<logger.level>WARN</logger.level>
<logger.app.level>INFO</logger.app.level>
<surefire.reportFormat>plain</surefire.reportFormat>
<surefire.printSummary>true</surefire.printSummary>
<surefire.useFile>false</surefire.useFile>
</properties>
</profile>
</profiles>

Categories