Can't build my Selenium Test using pom.xml - java

Hi im new in selenium and im trying to build a test using maven. I followed some steps in running/setting up maven via pom.xml file. i tried to updated the Maven project but still the same error is displayed. However, im encountering an error. see details of pom.xml file and the error. Please help im just new in using Selenium Web and just want to learn.
<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>FAM.Automation.Test</groupId>
<artifactId>FAM.Automation.Selenium</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<jre.level>1.8</jre.level>
<jdk.level>1.8</jdk.level>
</properties>
<build>
<plugins>
<!-- Compiler plug-in -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
<version>3.6.1</version>
</plugin>
<!-- Below plug-in is used to execute tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<suiteXmlFiles>
<suite name="Suite" parallel="none">
<test name="Test">
<classes>
<class name="Automation.fam.test.GoogleHomePageTitle"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
<!-- TestNG suite XML files -->
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.8</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Error when building the test:
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building FAM.Automation.Selenium 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # FAM.Automation.Selenium ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) # FAM.Automation.Selenium ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # FAM.Automation.Selenium ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) # FAM.Automation.Selenium ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) # FAM.Automation.Selenium ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.201 s
[INFO] Finished at: 2018-03-09T19:02:34+08:00
[INFO] Final Memory: 11M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project FAM.Automation.Selenium: Unable to parse configuration of mojo org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test for parameter suiteXmlFiles: Basic element 'suite' must not contain child elements -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginConfigurationException

suiteXmlFiles: Basic element 'suite' must not contain child elements
I think you should not use
<suite ...
inside
<suiteXmlFiles>
Use <suiteXmlFiles> to include a file.
Ref:
http://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html

Related

Why maven cannot add my dependency to jar?

I'm new to maven and one simple thing I wanted to do is pull maven repository and use it in my project.
but this has happened.
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ToolsQA</groupId>
<artifactId>jutil_table</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>jutil_table</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.chrisgleissner</groupId>
<artifactId>jutil-protobuf</artifactId>
<version>1.1.11</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
App.java
package ToolsQA;
/**
* Hello world!
*
*/
import static com.github.chrisgleissner.jutil.table.TablePrinter.DefaultTablePrinter;
import static java.util.Arrays.asList;
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
Iterable<String> HEADERS = asList("id", "name", "age");
DefaultTablePrinter.print(HEADERS, null);
}
}
Complete Error message
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< ToolsQA:jutil_table >-------------------------
[INFO] Building jutil_table 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # jutil_table ---
[INFO] Deleting C:\Users\Pawar\Desktop\mvn_tutorial\jutil_table\jutil_table\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # jutil_table ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\Pawar\Desktop\mvn_tutorial\jutil_table\jutil_table\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) # jutil_table ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to C:\Users\Pawar\Desktop\mvn_tutorial\jutil_table\jutil_table\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/Pawar/Desktop/mvn_tutorial/jutil_table/jutil_table/src/main/java/ToolsQA/App.java:[8,53] package com.github.chrisgleissner.jutil.table does not exist
[ERROR] /C:/Users/Pawar/Desktop/mvn_tutorial/jutil_table/jutil_table/src/main/java/ToolsQA/App.java:[8,2] static import only from classes and interfaces
[ERROR] /C:/Users/Pawar/Desktop/mvn_tutorial/jutil_table/jutil_table/src/main/java/ToolsQA/App.java:[18,10] cannot find symbol
symbol: variable DefaultTablePrinter
location: class ToolsQA.App
[INFO] 3 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.037 s
[INFO] Finished at: 2020-05-24T22:49:15+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project jutil_table: Compilation failure: Compilation failure:
[ERROR] /C:/Users/Pawar/Desktop/mvn_tutorial/jutil_table/jutil_table/src/main/java/ToolsQA/App.java:[8,53] package com.github.chrisgleissner.jutil.table does not exist
[ERROR] /C:/Users/Pawar/Desktop/mvn_tutorial/jutil_table/jutil_table/src/main/java/ToolsQA/App.java:[8,2] static import only from classes and interfaces
[ERROR] /C:/Users/Pawar/Desktop/mvn_tutorial/jutil_table/jutil_table/src/main/java/ToolsQA/App.java:[18,10] cannot find symbol
[ERROR] symbol: variable DefaultTablePrinter
[ERROR] location: class ToolsQA.App
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
I read lot of articles and lot of related questions on stackoverflow about this. but still maven is unable to download the repo. and build is failing.
I used mvn compile, mvn package, mvn clean install nothing worked for me.
Please help✌️
As per the documentation, you need to have all three dependencies. That issue you have posted is not directly relevant to maven. That says the compiler cannot find symbols, may be because the class is not there in the classpath. Try with all the dependencies included.
Or in this case, what you really need the dependency for jutil-table only. You can omit the other two. But your maven pom contain jutil-protobuf dependency.
<dependency>
<groupId>com.github.chrisgleissner</groupId>
<artifactId>jutil-protobuf</artifactId>
<version>1.1.11</version>
</dependency>
<dependency>
<groupId>com.github.chrisgleissner</groupId>
<artifactId>jutil-sql-log</artifactId>
<version>1.1.11</version>
</dependency>
<dependency>
<groupId>com.github.chrisgleissner</groupId>
<artifactId>jutil-table</artifactId>
<version>1.1.11</version>
</dependency>
And build the jar including the dependencies using maven assembly plugin
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<mainClass> // Main class Ex : com.Test </mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>

Building an executable JavaFX app with java SDK 11.0.6

I have a JavaFX app that I have successfully built and run with Java SDK 1.8. I am trying to move it to Java 11 with an ultimate goal of using Java 14 and can not create a runnable jar. To try and understand the process I have downloaded the javafx helloFX example and tried to follow the instructions at https://openjfx.io/openjfx-docs/#modular for Maven. When I run the mvn clean javafx:jlink I get the error:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< org.openjfx:hellofx >-------------------------
[INFO] Building demo 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # hellofx ---
[INFO] Deleting C:\Users\jungl\eclipse-workspace\helloFX\Maven\hellofx\target
[INFO]
[INFO] --- javafx-maven-plugin:0.0.3:jlink (default-cli) # hellofx ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\jungl\eclipse-workspace\helloFX\Maven\hellofx\src\main\resources
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\jungl\eclipse-workspace\helloFX\Maven\hellofx\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.345 s
[INFO] Finished at: 2020-04-14T14:52:18+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.openjfx:javafx-maven-plugin:0.0.3:jlink (default-cli) on project hellofx: Error: jlink requires a module descriptor -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
The pom.xml is
<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>org.openjfx</groupId>
<artifactId>hellofx</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>demo</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.3</version>
<configuration>
<mainClass>HelloFX</mainClass>
<jlinkImageName>hello></jlinkImageName>
<jlinkZipName>hellozip></jlinkZipName>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- https://mvnrepository.com/artifact/com.zenjava/javafx-maven-plugin -->
Can anyone point me in the correct direction as I am failing to understand the issue.
The provided example is not structured as the tutorial says. The maven version has been updated under the CommandLine folder. If you go to: ..\CommandLine\Modular\Maven\helloFX and enter the commands mvn clean javafx:run, clean javafx:jlink, target\hellofx\bin\launcher it runs as described in the tutorial.

Karate Api Testing with Maven and Jenkins [duplicate]

This question already has an answer here:
json files and called features not found in jenkins (with Karate Framework)
(1 answer)
Closed 1 year ago.
I am using karate default arche type as mentioned in the karate tutorial and running testing successfully with cucumber reports using Eclipse but when i use the same project in Jenkins i am getting following error.
I am using Java 1.8 and Cucumber-reporting tool, Please help me solving this issue as i suspect this is issue with the project structure
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f D:\CogsdaleWorkspace\karate-archetype\pom.xml clean test
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.mycompany:myproject >-----------------------
[INFO] Building myproject 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # myproject ---
[INFO] Deleting D:\CogsdaleWorkspace\karate-archetype\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # myproject ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\CogsdaleWorkspace\karate-archetype\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.0:compile (default-compile) # myproject ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # myproject ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 10 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.0:testCompile (default-testCompile) # myproject ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to D:\CogsdaleWorkspace\karate-archetype\target\test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /D:/CogsdaleWorkspace/karate-archetype/src/test/java/nexusportalapi/TestParallel.java:[3,24] package org.junit does not exist
[ERROR] /D:/CogsdaleWorkspace/karate-archetype/src/test/java/nexusportalapi/TestParallel.java:[3,1] static import only from classes and interfaces
[ERROR] /D:/CogsdaleWorkspace/karate-archetype/src/test/java/nexusportalapi/TestParallel.java:[11,17] package org.junit does not exist
[ERROR] /D:/CogsdaleWorkspace/karate-archetype/src/test/java/nexusportalapi/TestParallel.java:[34,10] cannot find symbol
symbol: class Test
location: class nexusportalapi.TestParallel
[INFO] 4 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.046 s
[INFO] Finished at: 2019-12-18T07:25:48-06:00
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.0:testCompile (default-testCompile) on project myproject: Compilation failure: Compilation failure:
[ERROR] /D:/CogsdaleWorkspace/karate-archetype/src/test/java/nexusportalapi/TestParallel.java:[3,24] package org.junit does not exist
[ERROR] /D:/CogsdaleWorkspace/karate-archetype/src/test/java/nexusportalapi/TestParallel.java:[3,1] static import only from classes and interfaces
[ERROR] /D:/CogsdaleWorkspace/karate-archetype/src/test/java/nexusportalapi/TestParallel.java:[11,17] package org.junit does not exist
[ERROR] /D:/CogsdaleWorkspace/karate-archetype/src/test/java/nexusportalapi/TestParallel.java:[34,10] cannot find symbol
[ERROR] symbol: class Test
[ERROR] location: class nexusportalapi.TestParallel
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
POM FILE
`http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>com.mycompany</groupId>
<artifactId>myproject</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<maven.compiler.version>3.6.0</maven.compiler.version>
<karate.version>0.9.4</karate.version>
</properties>
<dependencies>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-apache</artifactId>
<version>${karate.version}</version>
</dependency>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-junit5</artifactId>
<version>${karate.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.4.0</version>
</dependency>
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.1</version>
</dependency>
</dependencies>
<build>
<testResources>
<testResource>
<directory>src/test/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<encoding>UTF-8</encoding>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerArgument>-Werror</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>
This is hard to tell with just this info, can you try 2 things:
upgrade to Karate version 0.9.5.RC5
use the version we have
tested with for the cucumber-reporting lib: 3.8.0 -
https://github.com/intuit/karate/tree/master/karate-demo#example-report
You are in the best position to troubleshoot this - but you can try follow this process if all else fails: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

ERROR: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy 405,

With maven, I want to deploy this project locally with all the dependencies to the tomcat server. But I get some errors. I use the operating system archlinux and tomcat installed in the "/opt" directory.
Java version: "11.0.2" 2019-01-15 LTS
Maven version:3.0.6
Tomcat version:9.0.17
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>TomcatServer</id>
<username>onur</username>
<password>onur123</password>
</server>
</servers>
<profiles>
<profile>
<properties>
<tomcathome>/opt/apache-tomcat-9.0.17</tomcathome>
</properties>
<repositories>
<repository>
<id>DefaultRepo</id>
<url>http://localhost:8080/estech</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
</profile>
</profiles>
</settings>
This is my pom.xml. I use maven deploy plugin for deploy to tomcat server. How can I fix this?
<?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.pmyo.group5</groupId>
<artifactId>estech</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<distributionManagement>
<repository>
<id>DefaultRepo</id>
<name>localhost</name>
<url>http://localhost:8080/estech/</url>
</repository>
</distributionManagement>
<name>estech Maven Webapp</name>
<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>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
<build>
<finalName>estech</finalName>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<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-war-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Error:
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< com.pmyo.group5:estech >-----------------------
[INFO] Building estech Maven Webapp 1.0
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) # estech ---
[INFO] Deleting /home/onur/IdeaProjects/Es-tech/estech/target
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) # estech ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/onur/IdeaProjects/Es-tech/estech/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) # estech ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 21 source files to /home/onur/IdeaProjects/Es-tech/estech/target/classes
[INFO] /home/onur/IdeaProjects/Es-tech/estech/src/main/java/Models/ProductComments.java: Some input files use or override a deprecated API.
[INFO] /home/onur/IdeaProjects/Es-tech/estech/src/main/java/Models/ProductComments.java: Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) # estech ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/onur/IdeaProjects/Es-tech/estech/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) # estech ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) # estech ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:3.2.2:war (default-war) # estech ---
[INFO] Packaging webapp
[INFO] Assembling webapp [estech] in [/home/onur/IdeaProjects/Es-tech/estech/target/estech]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/onur/IdeaProjects/Es-tech/estech/src/main/webapp]
[INFO] Webapp assembled in [152 msecs]
[INFO] Building war: /home/onur/IdeaProjects/Es-tech/estech/target/estech.war
[INFO]
[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-cli) # estech ---
Uploading to DefaultRepo: http://localhost:8080/estech/com/pmyo/group5/estech/1.0/estech-1.0.war
Uploading to DefaultRepo: http://localhost:8080/estech/com/pmyo/group5/estech/1.0/estech-1.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.847 s
[INFO] Finished at: 2019-05-02T19:48:25+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-cli) on project estech: Failed to deploy artifacts: Could not transfer artifact com.pmyo.group5:estech:war:1.0 from/to DefaultRepo (http://localhost:8080/estech/): Failed to transfer file http://localhost:8080/estech/com/pmyo/group5/estech/1.0/estech-1.0.war with status code 405 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
maven-deploy-plugin is not for deploying your WAR into Tomcat. It is used to transfer build artifacts into repository.
You should take a look at tomcat-maven-plugin or cargo-maven-plugin

Maven: package org.junit does not exist

I'm new to Maven, so excuse me if this is so elemental. I have searched about this problem, and everyone seems to solve it removing the tag from the pom.xml file.
I do not have that tag there:
<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>GraphApp</groupId>
<artifactId>GraphApp</artifactId>
<version>1.0.0</version>
<name>MyApp</name>
<description>MyApp</description>
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
I have converted an existing project with Eclipse, so the problem may come from that.
Also, I have read that the default schema for Maven is storing the code at some default folders, while I'm using src/com/romanrdgz/core/myapp and /test/com/romanrdgz/test/core. That could also be the origin of the problem.
I am seeing this error:
Maven: package org.junit does not exist
What do I need to change?
EDIT: Ok, I have included JUnit4 as dependency, and I have also changed my file folders to be like this:
Still, when I go to console and execute mvn test or mvn compile, I get the following output:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building GraphApp 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # GraphApp -
--
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\rrrp\workspace\GraphApp\src\
main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # GraphApp ---
[INFO] Nothing to compile - all classes are up to date
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.515 s
[INFO] Finished at: 2015-04-15T08:15:06+02:00
[INFO] Final Memory: 11M/309M
[INFO] ------------------------------------------------------------------------
I tried erasing bin and target folders, but still the same. Looks like it does not find the classes nor the tests.
Any help?
Add the junit dependency to the pom file in a dependencies section
<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">
.....
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
</dependencies>
</project>

Categories

Resources