Problem
I have a project with unit tests and integration tests with selenium.
When I execute cucumber integration test with IntelliJ it works well as you can see:
Cucumber integration tests executed with Intellij
But, when I execute mvn integration-test, It seems that maven-failsafe-plugin doesn't find any integration test:
Failsafe output
Project information
I defined the follow 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.weblogism.cucumberjvm</groupId>
<artifactId>java-example</artifactId>
<version>1.3.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Cucumber-jvm Java Example</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<cucumber.plugin>pretty</cucumber.plugin>
<cucumber.filter.tags>#wip</cucumber.filter.tags>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>5.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>5.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>5.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.1.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.picocontainer</groupId>
<artifactId>picocontainer</artifactId>
<version>2.15</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>cuke-jvm-example</finalName>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-java</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>1.8.0</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>18</source>
<target>18</target>
</configuration>
</plugin>
<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/it/java</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/it/resources</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M4</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<failIfNoTests>true</failIfNoTests>
<systemPropertyVariables>
<cucumber.plugin>${cucumber.plugin}</cucumber.plugin>
<cucumber.filter.tags>${cucumber.filter.tags}</cucumber.filter.tags>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
The folders structure is
Folder structure
mvn integration-test output
https://drive.google.com/file/d/19PlmIvX7AN45DviOaQeB0dyB7jYsI05E/view?usp=sharing
I'm using spring-boot-maven-plugin to start/end server at start/end integration-test
I'm using build-helper-maven-plugin to get the it folder sources, where integration-test are defined
By using cucumber-junit you are running Cucumber through JUnit 4, however Spring Boot 2.7 uses JUnit 5 and no longer includes junit-vintage by default. As a result JUnit 4 test are not executed.
Consider either using the cucumber-junit-platform-engine or adding junit-vintage.
Related
When I Compile my project I get the error:
"java: package net.serenitybdd.core.pages does not exist"
enter image description here
When I run the Project I get the error:
"Could not transfer artifact org.apache.maven.plugins: maven-enforcer-plugin: pom: 1.4 from / to central (https://repo.maven.apache.org/maven2): Transfer failed for https: // repo .maven.apache.org / maven2 / org / apache / maven / plugins / maven-enforcer-plugin / 1.4 / maven-enforcer-plugin-1.4.pom "
enter image description here
I have this same Project on my local PC and it works correctly. Now that I am passing it to my work station that happens.
I was checking and it seems that McAfee-Agent Antivirus is blocking it?
enter image description here
If you could help me it would be great, thank you.
IDE IntelliJ - Proyecto Maven
this is my POM:
4.0.0
<groupId>org.example</groupId>
<artifactId>ToMapfre</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<serenity.version>2.0.54</serenity.version>
<serenity.maven.version>2.0.54</serenity.maven.version>
<serenity.cucumber.version>1.6.4</serenity.cucumber.version>
</properties>
<dependencies>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-core</artifactId>
<version>2.0.54</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-junit</artifactId>
<version>${serenity.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-cucumber</artifactId>
<version>${serenity.cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>enforce</id>
<configuration>
<rules>
<AlwaysPass/>
</rules>
<fail>true</fail>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18</version>
<configuration>
<includes>
<include>**/*RunnerTest.java</include>
</includes>
<reuseForks>true</reuseForks>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>net.serenity-bdd.maven.plugins</groupId>
<artifactId>serenity-maven-plugin</artifactId>
<version>${serenity.maven.version}</version>
<dependencies>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-core</artifactId>
<version>${serenity.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>serenity-reports</id>
<phase>post-integration-test</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Try this:
Delete .idea folder.
in .m2/repository/ find problem dependencies and delete they too.
Than open project from pom.xml (from menu -> Open - Projects folder -> pom.xml)
Sometimes helps.
I have page object model for running automated tests, and I have a java class under pages package org.jbehave.web.webdriver.pages.test. I would like to run only the specific test.java class using jar file built based on maven pom file. Where should I add my main class in the pom file and run only the specific class?
I tried adding it in the phase, but I get the error as "Could not find goal 'java' in plugin org.jbehave:jbehave-maven-plugin:4.0.3 among available goals map-stories-as-paths,"
Here is example of pom file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>jbehave-web-webdriver</groupId>
<artifactId>jbehave-web-webdriver</artifactId>
<version>1.0</version>
<name>JBehave WebDriver Stories</name>
<description>
</description>
<properties>
<jbehave.webapp.name>trader-runner</jbehave.webapp.name>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.jbehave.web</groupId>
<artifactId>jbehave-web-selenium</artifactId>
<version>3.6-beta-2</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.44.0</version>
</dependency>
<dependency>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-core</artifactId>
<version>4.0.4</version>
</dependency>
<dependency>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-core</artifactId>
<version>4.0.4</version>
<classifier>resources</classifier>
<type>zip</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.20</version>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
<version>4.0.3</version>
<executions>
<execution>
<id>run-stories</id>
<phase>integration-test</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.java2s.ide.App</mainClass>
<configuration>
</configuration>
</execution>
<execution>
<id>unpack-view-resources</id>
<phase>process-resources</phase>
<goals>
<goal>unpack-view-resources</goal>
</goals>
<configuration>
<viewDirectory>target/jbehave/view</viewDirectory>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>11.0.1</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
<version>1.5.3</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.5.3</version>
</dependency>
</dependency>
</dependencies>
</plugin> -->
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
<versionRange>[3.9.1,)</versionRange>
<goals>
<goal>unpack-view-resources</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
If you want to run your java program and your project is maven-based, then you can use shaded type of building your jar file. It can help you to have one fat jar which all your dependencies would be added to it. **Additionally, you can specify your main class in its underlying tags too, like: **
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>MAIN_CLASS_ADDRESS</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
</project>
e.g. "org.sonatype.haven.HaveCli" for a class named HaveCli.
I'm working with Java 8 in a project that requires some libraries from JavaFX the problem is that I have already added some other libraries like JFreeChart to my project and only need to import the jar and all the dependencies.
However with JavaFX I can't do it, I got missing several dependencies like osgi.wiring.package=org.w3c.dom.html, but I can't solved it, so how would be the proper way to work with Maven, OSGi and JavaFX?
I left my pom file so you can see how I'm configuring it.
<?xml version="1.0"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.EconTech</groupId>
<artifactId>Dashboard</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Inside Dashboard</name>
<packaging>bundle</packaging>
<properties>
<!--********************************************************************-->
<!-- Note: Update this section with relevant meta data -->
<!-- that comes along with your URCap -->
<!--********************************************************************-->
<!--******************* BEGINNING OF URCAP META DATA *******************-->
<urcap.symbolicname>com.EconTech.Dashboard</urcap.symbolicname>
<urcap.vendor>Econ Tech S.A. de C.V.</urcap.vendor>
<urcap.contactAddress>info#econ-tech.com</urcap.contactAddress>
<urcap.copyright>Copyright © 2019 ECON Tech. All rights reserved.</urcap.copyright>
<urcap.description>Shows and saves robot information inside itself</urcap.description>
<urcap.licenseType>Apache License 2.0</urcap.licenseType>
<!--********************** END OF URCAP META DATA **********************-->
<!--********************************************************************-->
<!-- Host, username and password of the robot to be used when running "mvn install -Premote" -->
<urcap.install.host>localhost</urcap.install.host>
<urcap.install.username>root</urcap.install.username>
<urcap.install.password>easybot</urcap.install.password>
<!-- <ursimvm.install.host></ursimvm.install.host>
<ursimvm.install.username>ur</ursimvm.install.username>
<ursimvm.install.password>easybot</ursimvm.install.password>-->
<!--Install path for the UR Sim-->
<ursim.home></ursim.home>
<!--Host and standard user/password for UR Sim running in a VM-->
<ursimvm.install.host></ursimvm.install.host>
<ursimvm.install.username>ur</ursimvm.install.username>
<ursimvm.install.password>easybot</ursimvm.install.password>
</properties>
<build>
<plugins>
<!-- Plugin for maven and JDK 1.8-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<runOrder>alphabetical</runOrder>
<useSystemClassLoader>false</useSystemClassLoader>
<includes>
<include>**/JFreeChartTestSuite.java</include>
</includes>
</configuration>
</plugin>
<!-- Este plugin es para agregar jars
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.4.0</version>
<extensions>true</extensions>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<instructions>
<!--********** DO NOT MODIFY THE ENTRIES OF THIS SECTION **********-->
<Bundle-Category>URCap</Bundle-Category>
<Bundle-Activator>com.EconTech.Dashboard.impl.Activator</Bundle-Activator>
<Bundle-Vendor>${urcap.vendor}</Bundle-Vendor>
<Bundle-ContactAddress>${urcap.contactAddress}</Bundle-ContactAddress>
<Bundle-Copyright>${urcap.copyright}</Bundle-Copyright>
<Bundle-LicenseType>${urcap.licenseType}</Bundle-LicenseType>
<Bundle-Description>${urcap.description}</Bundle-Description>
<!--***************************************************************-->
<Import-Package>
com.ur.urcap.api*;version="[1.4.0,2.0.0)", org.jfree.jfreechart*;resolution:=optional,
org.jfree.jcommon*;resolution:=optional, javax.servlet.*;resolution:=optional,
eu.hansolo.Medusa*;resolution:=optimal, com.oracle.javafx*;resolution:=optimal,
org.eclipse.platform*;resolution:=optimal, org.w3c.dom*;resolution:=optimal,
<!-- org.openjfx.javafx-controls*;resolution:=optimal, !com.EconTech.Dashboard.jfreechart-1.0.19.*, !com.EconTech.Dashboard.jcommon-1.0.23.*, -->
*
</Import-Package>
<!-- !org.openjfx.javafx-controls, -->
<Embed-Dependency>
!org.jfree.jfreechart, !org.jfree.jcommon, !javax.servlet,
!com.oracle.javafx, !org.osgi.core, !com.ur.urcap.api,
!org.eclipse.platform, !org.w3c.dom; scope=compile|runtime
</Embed-Dependency>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<!-- generate URCap package after compiling -->
<execution>
<id>package-urcap</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>cp</executable>
<commandlineArgs>target/${project.build.finalName}.jar target/${project.build.finalName}.urcap</commandlineArgs>
<workingDirectory>.</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- JavaFX Dependency-->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>javafx</artifactId>
<version>8.0.60</version>
</dependency>
<!-- Eclipse SWT Dependency-->
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.swt</artifactId>
<version>3.106.3</version>
</dependency>
<!-- Eclipse SWT Dependency
<dependency>
<groupId>org.w3c.dom</groupId>
<artifactId>org.w3c.dom.css</artifactId>
<version>1.0</version>
</dependency>-->
<dependency>
<groupId>org.w3c</groupId>
<artifactId>dom</artifactId>
<version>2.3.0-jaxb-1.0.6</version>
</dependency>
<!-- <dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>11.0.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>11.0.2</version>
</dependency> -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.3.0</version>
</dependency>
<!-- jcommon Dependency-->
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jcommon</artifactId>
<version>1.0.23</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<!-- Medusa Dependency for gauges-->
<dependency>
<groupId>eu.hansolo</groupId>
<artifactId>Medusa</artifactId>
<version>8.3</version>
</dependency>
<!-- jfreechart Dependency -->
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.19</version>
</dependency>
<dependency>
<groupId>com.ur.urcap</groupId>
<artifactId>api</artifactId>
<version>1.4.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.xmlrpc</groupId>
<artifactId>xmlrpc-client</artifactId>
<version>3.1.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.xmlrpc</groupId>
<artifactId>xmlrpc-common</artifactId>
<version>3.1.3.0</version>
<exclusions>
<exclusion>
<groupId>org.antlr</groupId>
<artifactId>stringtemplate</artifactId>
</exclusion>
<exclusion>
<groupId>org.antlr</groupId>
<artifactId>antlr-runtime</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.util</groupId>
<artifactId>ws-commons-util</artifactId>
<version>1.0.2.0</version>
<exclusions>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1.0.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>remote</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>remote-install-urcap</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sshpass</executable>
<commandlineArgs>-p ${urcap.install.password} scp -o StrictHostKeyChecking=no target/${project.build.finalName}.jar ${urcap.install.username}#${urcap.install.host}:/root/.urcaps/${urcap.symbolicname}.jar</commandlineArgs>
<workingDirectory>.</workingDirectory>
</configuration>
</execution>
<execution>
<id>remote-restart-ui</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sshpass</executable>
<commandlineArgs>-p ${urcap.install.password} ssh ${urcap.install.username}#${urcap.install.host} pkill java</commandlineArgs>
<workingDirectory>.</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>local</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>local-install-urcap</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>cp</executable>
<commandlineArgs>target/${project.build.finalName}.jar ${user.home}/.urcaps/${urcap.symbolicname}.jar</commandlineArgs>
<workingDirectory>.</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>ursim</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>ursim-install-urcap</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>cp</executable>
<commandlineArgs>target/${project.build.finalName}.jar ${ursim.home}/.urcaps/${urcap.symbolicname}.jar</commandlineArgs>
<workingDirectory>.</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>ursimvm</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>ursimvm-install-urcap</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sshpass</executable>
<commandlineArgs>-p ${ursimvm.install.password} scp -o StrictHostKeyChecking=no target/${project.build.finalName}.jar ${ursimvm.install.username}#${ursimvm.install.host}:/home/ur/ursim-current/.urcaps/${urcap.symbolicname}.jar</commandlineArgs>
<workingDirectory>.</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
In the sample example in Netbeans (DukeScript Application) the archetype creates this POM.xml for Maven. I tried commenting out the JUNIT dependency and putting in TestNG.
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
<scope>test</scope>
</dependency>
I am still getting errors. Any ideas on how to convert to Testng? Yes they are generally just testing suites but I have a bunch of code built for base classes I would like to reuse.
<?xml version="1.0"?>
<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>b</groupId>
<artifactId>a-pom</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>b</groupId>
<artifactId>a</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>a General Client Code</name>
<properties>
<netbeans.compile.on.save>all</netbeans.compile.on.save>
<project.mainclass>b.a.Main</project.mainclass>
<exec.java.bin>${java.home}/bin/java</exec.java.bin>
<exec.debug.arg>-Ddebug=false</exec.debug.arg>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>b.a</Export-Package>
<Bundle-SymbolicName>b.a</Bundle-SymbolicName>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<junitArtifactName>com.dukescript.api:junit-osgi</junitArtifactName>
<systemPropertyVariables>
<fxpresenter.headless>true</fxpresenter.headless>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>post-integration-test</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<executable>${exec.java.bin}</executable>
<classpathScope>runtime</classpathScope>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>-javaagent:${project.build.directory}/springloaded.jar</argument>
<argument>-Xverify:none</argument>
<argument>-Dbrowser.rootdir=${basedir}/src/main/webapp/</argument>
<argument>-Dnetbeans.inspect.port=${netbeans.inspect.port}</argument>
<argument>${exec.debug.arg}</argument>
<argument>${project.mainclass}</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy</id>
<phase>process-classes</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>1.2.3.RELEASE</version>
<type>jar</type>
<overWrite>false</overWrite>
<destFileName>springloaded.jar</destFileName>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>web-pages</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/webpages.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.netbeans.html</groupId>
<artifactId>net.java.html</artifactId>
<version>${net.java.html.version}</version>
</dependency>
<dependency>
<groupId>org.netbeans.html</groupId>
<artifactId>net.java.html.json</artifactId>
<version>${net.java.html.version}</version>
</dependency>
<dependency>
<groupId>org.netbeans.html</groupId>
<artifactId>net.java.html.boot</artifactId>
<version>${net.java.html.version}</version>
</dependency>
<dependency>
<groupId>org.netbeans.html</groupId>
<artifactId>net.java.html.sound</artifactId>
<version>${net.java.html.version}</version>
</dependency>
<dependency>
<groupId>org.netbeans.html</groupId>
<artifactId>ko4j</artifactId>
<version>${net.java.html.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>b</groupId>
<artifactId>a-js</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.netbeans.html</groupId>
<artifactId>net.java.html.boot.fx</artifactId>
<version>${net.java.html.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dukescript.api</groupId>
<artifactId>junit-osgi</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.dukescript.api</groupId>
<artifactId>junit-browser-runner</artifactId>
<version>${junit.browser.version}</version>
<scope>test</scope>
<type>jar</type>
</dependency>
<!-- Nashorn presenter for BrowserRunner
<dependency>
<groupId>org.netbeans.html</groupId>
<artifactId>net.java.html.boot.script</artifactId>
<version>${net.java.html.version}</version>
<scope>test</scope>
<type>jar</type>
</dependency>
-->
<!-- Bck2Brwsr VM presenter for BrowserRunner - - >
<dependency>
<groupId>org.apidesign.bck2brwsr</groupId>
<artifactId>launcher.http</artifactId>
<version>${bck2brwsr.version}</version>
<scope>test</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apidesign.bck2brwsr</groupId>
<artifactId>ko-bck2brwsr</artifactId>
<version>${bck2brwsr.version}</version>
<classifier>bck2brwsr</classifier>
<scope>test</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.dukescript.api</groupId>
<artifactId>junit-browser-runner</artifactId>
<version>${junit.browser.version}</version>
<scope>test</scope>
<classifier>bck2brwsr</classifier>
<type>jar</type>
</dependency>
< ! - - End of Bck2Brwsr VM presenter for BrowserRunner -->
</dependencies>
<profiles>
<profile>
<id>javafx</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>org.netbeans.html</groupId>
<artifactId>net.java.html.boot.fx</artifactId>
<version>${net.java.html.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>desktop</id>
<dependencies>
<dependency>
<groupId>org.netbeans.html</groupId>
<artifactId>net.java.html.boot.fx</artifactId>
<version>${net.java.html.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<mainClass>${project.mainclass}</mainClass>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<useUniqueVersions>false</useUniqueVersions>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>distro-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/javafx.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>webkit-presenter</id>
<dependencies>
<dependency>
<groupId>com.dukescript.presenters</groupId>
<artifactId>webkit</artifactId>
<version>${presenters.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>browser-presenter</id>
<dependencies>
<dependency>
<groupId>com.dukescript.presenters</groupId>
<artifactId>browser</artifactId>
<version>${presenters.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
Add testng dependency to pom
Comment out the 2 JUNIT dependencies
You only need imports org.testng. Assert; annotations.*;
In your Test package.
Remove #RunWith
Assert.assertTrue(arr.get(0).startsWith("Hello"));
Phone post
This question already has an answer here:
Error in Maven building?
(1 answer)
Closed 9 years ago.
I wrote
mvn -f pom.xml compile exec:java -Dexec.classpathScope=Compile-Dexec.main Class=storm.starter.WordCountTopology
Here this the error
[INFO] One or more required plugin parameters are invalid/missing for 'exec:java'
here's what's in the pom.xml
<project 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>storm.starter</groupId>
<artifactId>storm-starter</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>storm-starter</name>
<url>https://github.com/nathanmarz/storm-starter</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>github-releases</id>
<url>http://oss.sonatype.org/content/repositories/github-releases/</url>
</repository>
<repository>
<id>clojars.org</id>
<url>http://clojars.org/repo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert-core</artifactId>
<version>2.0M8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jmock</groupId>
<artifactId>jmock</artifactId>
<version>2.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>storm</groupId>
<artifactId>storm</artifactId>
<version>0.9.0.1</version>
<!-- keep storm out of the jar-with-dependencies-->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>15.0</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/jvm</sourceDirectory>
<testSourceDirectory>test/jvm</testSourceDirectory>
<resources>
<resource>
<directory>${basedir}/multilang</directory>
</resource>
</resources>
<plugins>
<!-- Bind the maven-assembly-plugin to the package phase this will create a jar file without the storm dependencies suitable for deployment to a cluster.-->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass/>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.theoryinpractise</groupId>
<artifactId>clojure-maven-plugin</artifactId>
<version>1.3.12</version>
<extensions>true</extensions>
<configuration>
<sourceDirectories>
<sourceDirectory>src/clj</sourceDirectory>
</sourceDirectories>
</configuration>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<includeProjectDependencies>true</includeProjectDependencies>
<includePluginDependencies>false</includePluginDependencies>
<classpathScope>compile</classpathScope>
<mainClass>${storm.topology}</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
How does your POM look like? You need to include the Exec-plugin, so that your POM will look like something like this:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
...
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>maven</executable>
<!-- optional -->
<workingDirectory>/tmp</workingDirectory>
<arguments>
<argument>-X</argument>
<argument>myproject:dist</argument>
...
</arguments>
</configuration>
</plugin>
</plugins>
</build>
...
</project>
(Source)