how to configure selenium cucumber framework in GitLab pipeline using gitlab-ci.yml configuration file - selenium

I facing the below error while running the selenium cucumber project in GitLab pipeline, using .gitlab-ci.yml configuration
[ERROR] Failed to execute goal on project Samplemaven: Could not resolve dependencies for project org.example:Samplemaven:jar:1.0-SNAPSHOT: Failed to collect dependencies at io.cucumber:cucumber-java:jar:7.2.3: Failed to read artifact descriptor for io.cucumber:cucumber-java:jar:7.2.3: Could not transfer artifact io.cucumber:cucumber-java:pom:7.2.3 from/to central (http://repo.maven.apache.org/maven2): Connection reset -> [Help 1]

To run selenium cucumber project in GitLab, we need to setup this .gitlab-ci.yml file under the root folder. Use the below configuration in .gitlab-ci.yml file.
image: maven:3.8.3-openjdk-17
cache:
paths:
- .m2/repository/
- target/
build:
stage: build
script:
- mvn compile
test:
stage: test
script:
- pwd
- mvn test
Makes sure you have used the below plugin in pom.xml file,
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>8</source>
<target>8</target>
<debug>true</debug>
<debuglevel>lines,vars,source</debuglevel>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
<configuration>
<includes>
<include>**/RunCukes*.java</include><!-- specify your runner file here -->
</includes>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
Note: While running the pom.xml as maven test in your local IDE it should trigger the cucumber runner file

Related

Maven Application got 5 Modules and 6 POM.xml files

I am working on existing Maven Project
Which has got 5 modules like
<modules>
<module>sideware</module>
<module>xmlmodule</module>
<module>business</module>
<module>service</module>
<module>helper</module>
</modules>
Each Module has got a one POM.xml file as well as
and one main Pom.xml
I am using Eclipse to run the POM.xml files as Maven install
Please tell me do i need to run the Each POM.xml indivudally ??
Or can i run the Parent POM.xml file once ??
Thank you
I think it is sufficient to run the parent POM. See the question What is the "reactor" in Maven? about the plugin that implements that for Maven. So you have the following options (at least):
Build the parent POM, which will build all modules as well.
Build a module individually, and it will build its dependencies automatically.
Here is a small experiment I have done on my own:
Build automatically == false.
Build a multi-module Maven project, and add there 2 modules.
Insert some code into the modules.
Run mvn install inside eclipse
As a result, I get the following output in the console:
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO] MultiModuleExample
[INFO] Unnamed - com.tsi.mli:sideware:jar:0.0.1-SNAPSHOT
[INFO] Unnamed - com.tsi.mli:business:jar:0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] Building MultiModuleExample
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [site:attach-descriptor {execution: default-attach-descriptor}]
[INFO] [install:install {execution: default-install}]
[INFO] Installing C:\projekte\setools-work\build\example-build-projekte\indigo-full\ws\multi-module-example\pom.xml to C:\Users\mliebelt\.m2\repository\com\tsi\mli\multi-module-example\0.0.1-SNAPSHOT\multi-module-example-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.tsi.mli:sideware:jar:0.0.1-SNAPSHOT
[INFO] task-segment: [install]
...
The directory structure I have got is:
multi-module-example/
business/
src/
target/
.classpath
.project
pom.xml
sideware/
...
src/
.project
pom.xml

Adobe BlazeDS 4 artifacts maven repository?

Does anybody know if Adobe has a maven repository to download the latest BlazeDS artifacts from?
I only can find the "older" versions of BlazeDS in the central mvn repository.
The other option is to deploy the downloaded BlazeDS jar files from the Adobe website into my local repository but it would be nice when Adobe provides the artifacts via a maven repository.
Spring's maven external repository does not contain these artifacts anymore (licencing issue?).
You should download the desired release from adobe, unzip and jar -x the contained war file and at last you must drop all the flex* jars into your local repo with:
mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds -Dversion=4.0.0.14931 -DartifactId=blazeds-common -Dfile=flex-messaging-common.jar
mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds -Dversion=4.0.0.14931 -DartifactId=blazeds-core -Dfile=flex-messaging-core.jar
mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds -Dversion=4.0.0.14931 -DartifactId=blazeds-opt -Dfile=flex-messaging-opt.jar
mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds -Dversion=4.0.0.14931 -DartifactId=blazeds-proxy -Dfile=flex-messaging-proxy.jar
mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds -Dversion=4.0.0.14931 -DartifactId=blazeds-remoting -Dfile=flex-messaging-remoting.jar
mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds -Dversion=4.0.0.14931 -DartifactId=blazeds-rds-server -Dfile=flex-rds-server.jar
or upload each in your private maven repository (i.e. artifactory or nexus).
Note: replace the version with the one you've downloaded
thanks to pledge's post in flex forum
https://src.springsource.org/svn/spring-flex/tags/spring-flex-1.5.0.RELEASE/local-repo/ seems to be working.
Add this repo to your pom.xml or settings.xml :
<repository>
<id>SpringFlex</id>
<name>SpringFlex Source Repo</name>
<url>https://src.springsource.org/svn/spring-flex/tags/spring-flex-1.5.0.RELEASE/local-repo/</url>
</repository>
This repository does not include checksums, so you will need to run Maven with the --lax-checksums option if you use this repository.
No, Adobe does not have a maven repository for BlazeDS. This thread can help. You can find BlazeDS 4 in the Spring maven repository: http://s3browse.springsource.com/browse/maven.springframework.org/external/com/adobe/blazeds/
After lot of searching, i have figured out proper maven repository for Blazeds-4.x.x.
<repository>
<id>spring-milestones</id>
<url>http://repo.spring.io/libs-milestone/</url>
This worked for me!!!
Thanks Cornel. I added the following snippet to my pom.
<repositories>
<repository>
<id>spring-maven-external</id>
<name>Springframework Maven External Repository</name>
<url>http://maven.springframework.org/external</url>
</repository>
</repositories>
I was missing blazeds-opt-4.0.0.14931, since it wasn't in the spring repository that srini posted. The following nexus repository provided the jar I needed:
<repository>
<id>NexusThirdParty</id>
<name>Nexus third party components</name>
<url>http://zcode.sunji.net/nexus/content/repositories/thirdparty/</url>
</repository>
https://src.springsource.org/svn/spring-flex/tags/spring-flex-1.5.2.RELEASE/local-repo/ seems to be working.
Add this repo to your pom.xml or settings.xml :
<repository>
<id>SpringFlex</id>
<name>SpringFlex Source Repo</name>
<url>https://src.springsource.org/svn/spring-flex/tags/spring-flex-1.5.2.RELEASE/local-repo/</url>
</repository>

How to query Pom version using maven

Is there a goal one can execute that will just echo the version of a pom? I can think of a way to make it work using the maven-ant-plugin, but that requires me to have ant-plugin configuration in the pom and I would like a method that would work with any pom.
mvn help:evaluate -Dexpression=project.version
If you want just the version echoed, and not the rest of the Maven "noise", you would use
mvn help:evaluate -Dexpression=project.version -q -DforceStdout

Running a task post maven install

I want to run a simple exec command post maven install phase. What is the simplest way possible to achieve this? (without adding new plugins)
If you want to run this command as part of the normal build lifecycle, there is no other way than binding the exec goal on the install phase:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<id>my-exec</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
<inherited>false</inherited>
</execution>
</executions>
<configuration>
<executable>COMMAND</executable>
</configuration>
</plugin>
</plugins>
</build>
I did a simple test using the configuration above (using ls as "COMMAND") with a freshly created maven project and running mvn install produces the following output:
$ mvn install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building maven-exec-testcase
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
...
[INFO] [install:install {execution: default-install}]
[INFO] Installing /home/pascal/Projects/maven-exec-testcase/target/maven-exec-testcase-1.0-SNAPSHOT.jar to /home/pascal/.m2/repository/com/mycompany/app/maven-exec-testcase/1.0-SNAPSHOT/maven-exec-testcase-1.0-SNAPSHOT.jar
[INFO] [exec:exec {execution: my-exec}]
[INFO] pom.xml
[INFO] src
[INFO] target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12 seconds
[INFO] Finished at: Tue Jan 05 19:26:04 CET 2010
[INFO] Final Memory: 11M/75M
[INFO] ------------------------------------------------------------------------
As we can see, the command is executed at the end of the install phase (after the copy of the artifact to the local repository).
And if you really don't want to add the snippet to your pom, then you'll have to explicitly call exec:exec after install on the command line as suggested by whaley.
The maven default lifecycle ends with the install and deploy goals - there is no pre- and post- version of those goals.
Potential options would be to:
Bind the exec:exec mojo to with the deploy phase. I would warn you against that idea as the deploy phase is really meant to deploy artifacts to a remote maven repository.
Run the exec:exec mojo after the install goal in your mvn invocation... e.g.:
mvn clean install exec:exec -Dexec.executable="yourcommand" -Dexec.args="arguments"
If you have a multi-module project, create another module at the end of your <modules> and bind exec:exec to any of the usual goals within that module. This will force this particular module to run last assuming other criteria the reactor looks at isn't met. A common strategy I employ with maven projects I work on is "when in doubt, create another module".

Maven: Missing: org.apache.maven.wagon:wagon-ftp:jar:1.0-rc1-SNAPSHOT

I'm new to Maven so I may be missing something obvious, but
I've got a maven project and when I try to "mvn package" this project it fails with
ERROR BUILD ERROR INFO
------------------------------------------------------------------------ [INFO] Failed to resolve artifact.
Missing:
---------- 1) org.apache.maven.wagon:wagon-ftp:jar:1.0-rc1-SNAPSHOT
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.apache.maven.wagon -DartifactId=wagon-ftp -Dversion=1.0-rc1-SNAPSHOT -Dpackaging=ja r -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.apache.maven.wagon -DartifactId=wagon-ftp -Dversion=1.0-rc1-SNAPSHOT -Dpackaging=jar
-Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) com.cgs:domain:jar:1.0-SNAPSHOT
2) org.apache.maven.wagon:wagon-ftp:jar:1.0-rc1-SNAPSHOT
----------
1 required artifact is missing.
for artifact: com.cgs:domain:jar:1.0-SNAPSHOT
from the specified remote repositories: ibiblio.org (http://mirrors.ibiblio.org/pub/mirrors/maven2)
The first thing I don't understand is the version it requires 1.0-rc1-SNAPSHOT. The projects' site says the current version is 1.0-beta-5. And I suppose beta goes before RC.
Anyway, I've tried to download the latest wagon-ftp JAR (1.0 beta 6 jar) and deploy it according to the instructions in the error message.
But guess what, this gave me the same error.
I've just found the solution as I was typing the end of this question.
The problem was that I was running "mvn install:install-file" from the same directory the failing project POM was in. It installed fine when I run it from another directory without a pom.xml.