Failure to find artefact SLF4J when including it in a maven project that uses jmeter plugin with maria-db connect included - maven

The jmx file uses a JSR223 sample to run some selenium code and at some point it needs to connect to a maria database to get a code.
pom:
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>kp-load-test</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>5.7.0</version>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>2.4.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<!-- Generate JMeter configuration -->
<execution>
<id>configuration</id>
<goals>
<goal>configure</goal>
</goals>
</execution>
<!-- Run JMeter tests -->
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
<!-- Fail build on errors in test -->
<execution>
<id>jmeter-check-results</id>
<goals>
<goal>results</goal>
</goals>
</execution>
</executions>
<configuration>
<jmeterExtensions>
<artifact>com.codeborne:selenide:5.7.0</artifact>
<artifact>org.mariadb.jdbc:mariadb-java-client:2.4.0</artifact>
</jmeterExtensions>
</configuration>
</plugin>
</plugins>
</build>
Running the following command : mvn clean verify throws the following error
[ERROR] Failed to execute goal com.lazerycode.jmeter:jmeter-maven-plugin:3.1.0:configure (configuration) on project kp-load-test: Failure to find org.slf4j:slf4j-api:jar:[1.4.0,1.7.25] in https://oss.sonatype.org/content/repositories/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of sonatype-nexus-snapshots has elapsed or updates are forced -> [Help 1]
If i comment the mariadb artifact from jmeterExtensions, the code selenium code will run and throw a driver exception when it reaches the jdbc part.
Looking in the mariadb jar i found the pom contained the following:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>[1.4.0,1.7.25]</version>
<optional>true</optional>
</dependency>
How can I pass mariadb artefact without generating that error?

Had to add
<downloadExtensionDependencies>false</downloadExtensionDependencies>
Afterwards i added each library needed for the script to run
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!topic/maven-jmeter-plugin-users/bf_uWS2TqXU

Related

Inconsistent behaviour between maven-surefire and tycho-surefire, with jacoco not generating reports

I'm working on creating a pom for a project and adding test cases to it. The project is an eclipse plugin.
Compiling the project with tycho works just fine, the only problem is during testing:
If I run both maven-surefire-plugin tests and tycho-surefire-plugin-tests, the former performs all the tests as expected, while the latter gives the following error:
Execution test of goal org.eclipse.tycho:tycho-surefire-plugin:1.7.0:test failed: Tycho build extension not configured for MavenProject
I would be perfectly fine to just add <skipTests>true</skipTests> to the tycho-surefire-plugin while keeping maven-surefire-plugin on; the problem is even that way, jacoco refuses to create the coverage site, with the following (non error) message:
Skipping JaCoCo execution due to missing execution data file.
I tried to look for solutions of both, but any combination of the solutions I found doesn't lead me to having a working coverage site.
Maven really makes me quite confused, especially with tycho around, so I'd apreciate any explanation on top of the actual fix.
Here is my pom:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>mygroupid</groupId>
<artifactId>myartifactid</artifactId>
<name>myname</name>
<packaging>eclipse-test-plugin</packaging>
<properties>
<tycho-version>1.7.0</tycho-version>
</properties>
<parent>
<groupId>parentgroupid</groupId>
<artifactId>parent</artifactId>
<version>0.9.5</version>
</parent>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.12.1.GA</version>
</dependency>
</dependencies>
<build>
<testSourceDirectory>src/test/java/</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
</configuration>
<executions>
<execution>
<id>test</id>
<phase>test</phase>
<configuration>
<includes>
<include>**/Test_*.java</include>
</includes>
</configuration>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
<executions>
<execution>
<id>test</id>
<phase>test</phase>
<configuration>
<includes>
<include>**/Test_*.java</include>
</includes>
</configuration>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<configuration>
<output>file</output>
<append>true</append>
<includes>
<include>**/path_to_source/**/*</include>
</includes>
</configuration>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>compiletests</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
And here is my parent pom:
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>parentgroupid</groupId>
<artifactId>parent</artifactId>
<version>0.9.5</version>
<packaging>pom</packaging>
<modules>
<module>moduleid</module>
</modules>
<properties>
<tycho-version>1.7.0</tycho-version>
</properties>
<repositories>
<repository>
<id>eclipse-2020-06</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/2020-06</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
<configuration>
<includeAllDependencies>true</includeAllDependencies>
</configuration>
</plugin>
</plugins>
</build>
</project>
Of course there won't be any test result for the JaCoCo due to you are using very old Surefire version 2.12.4. This version was not created for JUnit5.
Use the latest version 3.0.0-M5 and see the tutorial.
If you want to have tiny POM, remove the dependency junit-jupiter-engine due to you do not need to have an access to the JUnit internals in your test code. The Surefire will download it shortly before the test runtime.
Your POM has several errors. Let's start with the root cause and then other priorities from high to low.
Whole problem is that Surefire does not know about JaCoCo. You have to tel "him" this way (see jacoco.agent) which "wires" both. Pls ead the documentation in the JaCoCo project:
<properties>
<jvm.args.tests>-Xmx2048m -Xms1024m -XX:SoftRefLRUPolicyMSPerMB=50 -Djava.awt.headless=true -Djdk.net.URLClassPath.disableClassPathURLCheck=true</jvm.args.tests>
<properties>
...
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>${jvm.args.tests} ${jacoco.agent}</argLine>
</configuration>
...
The next error is with the way how you use plugins. The plugin jacoco-maven-plugin must be used only in the plugins section. The problem is that you use it also in the dependencies section. You do not want to have it on the classpath. It is job of the property jacoco.agent to put the jacoco agent on the test classpth only but there the JaCoCo plugin must start before the Surefire plugin.
The next thing i do not understand is the config of the compiler. Why you have this?
<executions>
<execution>
<id>compiletests</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
I have second question regarding the packaging. I have never seen this one. It isn't a standard packaging.
<packaging>eclipse-test-plugin</packaging>
Has the Eclipse plugin any special binary form of the archive file?

Migrate from jars in flyway maven plugin

Is it possible to migrate from jars in maven flyway plugin? I have no problems with sqls and java (compiled to class) but no success with jars. Classpath is set correctly.
Ok, i've debugged the source code. Jar needs a special protocol that is being provided to it when it is placed in /jars catalog in flyway command line tool. There is no such an equivalent in a flyway maven plugin.
This is a slight workaround to the limitation of the flyway-maven-plugin executing from a jar artifact file containing multiple flyway SQL files.
Create a profile
Use the 'maven-dependency-plugin:unpack' to explode the content of your jar file to specific directory.
Run 'flyway-maven-plugin' with a 'location' limited to the extracted directory.
Not very pretty but works.
This is my sample profile
<profiles>
<profile>
<id>flyway</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>copy</id>
<phase>process-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.abc</groupId>
<artifactId>flyway</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/jars</outputDirectory>
<destFileName>my-flyway.jar</destFileName>
</artifactItem>
</artifactItems>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</plugin>
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>${flyway.version}</version>
<configuration>
<sqlMigrationSeparator>__</sqlMigrationSeparator>
<locations>
<location>filesystem:./target/jars/my-flyway.jar</location>
</locations>
<url>${flyway.url}</url>
<user>${flyway.user}</user>
<password>${flyway.password}</password>
<schemas>
<schema>my_schema</schema>
</schemas>
<baselineOnMigrate>true</baselineOnMigrate>
</configuration>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
The maven command line is then
mvn -P flyway clean process-resources flyway:migrate

executing jmeters junit sampler with maven

I want to perform load tests on a jmeters junit sampler by using maven and want report the performanceresults. I used 10 threads with a ramp up period of 5 sec.here is my pom file
enter code here <properties>
<selenium.version>3.0.1</selenium.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.2.0</version>
<executions>
<execution>
<id>jmeter-classes</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<junitLibraries>
<artifact>com.lazerycode.junit:junit-test:1.0.0</artifact>
</junitLibraries>
<propertiesGlobal>
<threads>10</threads>
<rampup>5</rampup>
</propertiesGlobal>
</configuration>
</plugin>
</plugins>
</build>
Please help me if it is a right way to call jmeter's junit request sampler.If not please help me with the corrections.
Also please help me how to report the performance results(e.g.reports)
Thanks and Regards
As per Adding additional libraries to the classpath chapter of the JMeter Maven Plugin documentation you should place dependencies under <jmeterExtensions> tag 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>jmeter-selenium-junit</groupId>
<artifactId>jmeter-selenium-junit-test</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>your-junit-jar</id>
<name>your junit repo</name>
<url>file:/path/to/your-junit-jar.jar</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.2.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<jmeterExtensions>
<artifact>org.seleniumhq.selenium:selenium-java:3.0.1</artifact>
<artifact>org.seleniumhq.selenium:selenium-firefox-driver:3.0.1</artifact>
</jmeterExtensions>
<junitLibraries>
<artifact>com.yourcompany.yourgroup:your-artifact:1.0-SNAPSHOT</artifact>
</junitLibraries>
</configuration>
</plugin>
</plugins>
</build>
</project>
Also be aware that there is a WebDriver Sampler JMeter Plugin which provides seamless JMeter integration with Selenium so you won't have to recompile Selenium code each time and have it inlined directly into .jmx file.

Maven uses different dependencies depending on which machine it runs?

I have a project that is building properly on my local machine. In my company we use a server machine to do the continuous integration but that machine has no connection to the internet. So I have set up artifactory and copied my whole repository to it. Then connected jenkins with this artifactory. So jenkins should do the build without any problem no? As it has the same setup as my local project.
After a few seconds of building a message pops up that he can't find a dependency:
[ERROR] Failed to execute goal on project crs-data: Could not resolve
dependencies for project com.ing.crs:crs-data:jar:1.1.3-SNAPSHOT:
Failed to collect dependencies for
[com.ing.crs:crs-framework:jar:1.1.3-SNAPSHOT (compile),
org.apache.openjpa:openjpa-all:jar:2.3.0 (provided),
ibm.websphere:j2ee6:jar:8.5.0 (provided),
ibm.websphere:jpaThinClient:jar:8.5.0 (provided),
com.google.guava:guava:jar:14.0.1 (compile),
org.hamcrest:hamcrest-all:jar:1.3 (test), junit:junit:jar:4.11 (test),
mockito-all:mockito-all:jar:1.8.4 (test), oracle.jdbc:ojdbc6:jar:11.2
(test), com.h2database:h2:jar:1.3.167 (test),
ibm.websphere:embeddedEJBContainer:jar:8.5.0 (test),
com.ing.be:bbllib.DeploymentInfo:jar:2.3.2 (provided)]: Failed to
read artifact descriptor for commons-dbcp:commons-dbcp:jar:1.4: Could
not transfer artifact commons-dbcp:commons-dbcp:pom:1.4 from/to
crs.maven.repo
(http://sdbeapp00433.devbe.development:8082/artifactory/repo): Access
denied to:
http://sdbeapp00433.devbe.development:8082/artifactory/repo/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.pom
-> [Help 1]
But locally the build doesn't even use commons-dbcp:commons-dbcp:pom:1.4. How is that possible????
The 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">
<parent>
<groupId>com.ing.crs</groupId>
<artifactId>crs-parent-pom</artifactId>
<version>1.1.3-SNAPSHOT</version>
<relativePath>../crs-parent-pom/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>crs-data</artifactId>
<version>${project.crs-data.version}</version>
<profiles>
<profile>
<id>default</id>
<properties>
<dbDictionary>disableAlterSeqenceIncrementBy=true</dbDictionary>
</properties>
</profile>
<profile>
<id>stubs</id>
<properties>
<dbDictionary></dbDictionary>
</properties>
</profile>
</profiles>
<dependencies>
<!-- CRS -->
<dependency>
<groupId>com.ing.crs</groupId>
<artifactId>crs-framework</artifactId>
<version>${project.crs-framework.version}</version>
</dependency>
<!-- Other -->
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-all</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ibm.websphere</groupId>
<artifactId>j2ee6</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ibm.websphere</groupId>
<artifactId>jpaThinClient</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<!-- test -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>mockito-all</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>oracle.jdbc</groupId>
<artifactId>ojdbc6</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.167</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ibm.websphere</groupId>
<artifactId>embeddedEJBContainer</artifactId>
<version>8.5.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ing.be</groupId>
<artifactId>bbllib.DeploymentInfo</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>crs-data</finalName>
<outputDirectory>target/crs-data</outputDirectory>
<plugins>
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.2.4</version>
<executions>
<execution>
<id>process</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<compilerArguments>-Aopenjpa.source=7 -Aopenjpa.metamodel=true</compilerArguments>
<processors>
<processor>org.apache.openjpa.persistence.meta.AnnotationProcessor6</processor>
</processors>
<outputDirectory>target/generated-sources/metamodel</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources/metamodel</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<version>2.3.0</version>
<executions>
<execution>
<id>enhancer_for_test</id>
<configuration>
<includes>**/entities/**/*.class</includes>
<includes>**/data/**/*.class</includes>
<addDefaultConstructor>true</addDefaultConstructor>
<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
</configuration>
<phase>compile</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>copy-test-persistence</id>
<phase>process-test-resources</phase>
<configuration>
<tasks>
<!--backup the "proper" persistence.xml-->
<copy file="${project.build.outputDirectory}/META-INF/persistence.xml" tofile="${project.build.outputDirectory}/META-INF/persistence.xml.proper"/>
<!--replace the "proper" persistence.xml with the "test" version-->
<!-- copy file="${project.build.testOutputDirectory}/META-INF/persistence.xml" tofile="${project.build.outputDirectory}/META-INF/persistence.xml"/-->
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>restore-persistence</id>
<phase>prepare-package</phase>
<configuration>
<tasks>
<!--restore the "proper" persistence.xml-->
<copy file="${project.build.outputDirectory}/META-INF/persistence.xml.proper" tofile="${project.build.outputDirectory}/META-INF/persistence.xml"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathLayoutType>custom</classpathLayoutType>
<customClasspathLayout>${artifact.artifactId}.${artifact.extension}</customClasspathLayout>
</manifest>
<manifestEntries>
<Implementation-Version>${project.version}</Implementation-Version>
<Build-Time>${timestamp}</Build-Time>
</manifestEntries>
</archive>
</configuration>
</plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.1.1</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
openjpa-maven-plugin
</artifactId>
<versionRange>
[1.0,)
</versionRange>
<goals>
<goal>enhance</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>false</runOnIncremental>
</execute>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.openjpa
</groupId>
<artifactId>
openjpa-maven-plugin
</artifactId>
<versionRange>
[2.2.1,)
</versionRange>
<goals>
<goal>enhance</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<resources>
<resource>
<directory>src/main/resources/</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
Your build is failing since Maven is failing to download dependencies from Artifactory due to an authentication issue:
Access denied to: http://sdbeapp00433.devbe.development:8082/artifactory/repo/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.pom
If you will look at the Artifactory access.log you should see a matching log entry about a denied download.
If you are working with the Artifactory Jenkins plugin, you can configure the resolver credentials as described here.
If you are not using the Artifactory Jenkins plugin, you should configure the Maven authentication as described in "Working With Maven". This requires adding the correct credentials to the Maven settings.xml file.
A third option is allowing anonymous access to Artifactory as described here. This will allow resolving dependencies from Artifactory without authentication.
commons-dbcp is probably a transitive dependency. If you want to find its origin, you should use the dependency:tree goal of the Maven dependency plugin which displays the dependency tree for this project.
As a side note, you should not use the "repo" repository. This is a default global virtual repository which effectively aggregates all other repositories. By configuring Maven with this URL, any request for an artifact will go through Artifactory which will search through all of the local and remote repositories defined in the system. It is better to work with a virtual repository which aggregates only the relevant repositories for your build.

JMS config settings for jetty deployment using cargo

We have a current web application that is deployed to OAS (Oracle Application Server).
I am trying to implement some functional tests using selenium for this application. I created a new maven project specifically for functional testing, which uses cargo to deploy the application war file (webapp-site.war) to the default container provided by cargo (Jetty). pom.xml attached at the end.
The problem I am facing is in trying to configure jms properties. The current setting in the web application uses OAS specific values from an environment specific jms.properties file (shown below):
java.naming.factory.initial=oracle.j2ee.rmi.RMIInitialContextFactory
java.naming.provider.url=opmn:ormi://localhost:6003:OC4J_DEV/default
java.naming.security.principal=username
java.naming.security.credentials=password
jms.queue.connection.factory.jndi=jms/QueueConnectionFactory
When I start up jetty using cargo, the deployment of the application war fails when it looks for the "RMIInitialContextFactory" and does not find it. This is an OAS specific jar which is not available in the global maven repository. I managed to download and install this jar in the local maven repo, but then it showed a missing class from another oracle specific jar not present in the global maven repo. Also, even I resolved all such dependencies to external jar, I am unsure of how it would perform with Jetty.
It would be really helpful to know how to configure these properties in cargo specific to jetty and have it picked up by the deployable application war.
Attaching the pom.xml of the functional test module below:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>webapp-automation</artifactId>
<packaging>jar</packaging>
<url>http://maven.apache.org</url>
<parent>
<groupId>com.webapp</groupId>
<artifactId>webapp</artifactId>
<version>11.0.5</version>
</parent>
<name>Functional tests for webapp</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<servlet.port>9090</servlet.port>
<seleniumHost>localhost</seleniumHost>
<seleniumPort>4444</seleniumPort>
<selenium.version>2.3</selenium.version>
<selenium.background>true</selenium.background>
</properties>
<dependencies>
<dependency>
<groupId>com.webap</groupId>
<artifactId>webapp-site</artifactId>
<type>war</type>
<version>${project.version.number}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.42.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.8.1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>${selenium.version}</version>
</plugin>
<!-- CARGO is used to deploy the RAPS application for functional testing -->
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.2</version>
<configuration>
<container>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
</dependency>
</dependencies>
</container>
<configuration>
<properties>
<cargo.servlet.port>${servlet.port}</cargo.servlet.port>
<cargo.datasource.datasource.ojdbc14>
cargo.datasource.driver=oracle.jdbc.driver.OracleDriver|
cargo.datasource.url=jdbc:oracle:thin:#deirbned01.deir.citec.qld.gov.au:1521:RAPSDEV|
cargo.datasource.jndi=jdbc/RAPSDS|
cargo.datasource.username=RAPS_9|
cargo.datasource.password=sm4u
</cargo.datasource.datasource.ojdbc14>
</properties>
</configuration>
<deployables>
<deployable>
<groupId>com.webapp</groupId>
<artifactId>webapp-site</artifactId>
<type>war</type>
</deployable>
</deployables>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Skip the normal tests, we'll run them in the integration-test phase -->
<skip>true</skip>
</configuration>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<executions>
<execution>
<id>start-cargo</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-cargo</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<executions>
<execution>
<id>start-selenium</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
</goals>
</execution>
<execution>
<id>stop-selenium</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop-server</goal>
</goals>
</execution>
</executions>
<configuration>
<background>${selenium.background}</background>
<port>${selenium.port}</port>
<logOutput>true</logOutput>
</configuration>
</plugin>
</plugins>
</build>
Any help would be great !!
Cheers,
Rahul
I found a way of solving the problem.
We use some environment specific settings in the project. I created a new environment profile in the build for functional tests and created a new jms.properties with the initial context factory pointing to the one provided by jetty.
It worked.
Cheers,
Rahul

Resources