I am new to Selenium and Maven tools. Trying to set up the Selenium 2.0 Java project using Maven, via this guide.
After creating and saving pom.xml in my project directory, I run mvn clean install and get the following error:
(...)
The goal you specified requires a project to execute but there is no POM
in this directory (C:\Users\User\Documents\TestAutomation). Please verify you invoked Maven from the
correct directory. -> [Help 1]
My pom.xml looks like this, as in the example from the link:
<?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>MySel20Proj</groupId>
<artifactId>MySel20Proj</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.45.0</version>
</dependency>
</dependencies>
</project>
I have Maven 3.3.1 and Java 1.8.0 installed on Windows 7.
Any idea, what am I doing wrong? I have little experience with testing tools in general.
OK, the problem was with the file extension. It was actually saved as pom.xml.txt, not pom.xml as I expected. (found that via dir command)
Related
I have created a maven project in Intellij Idea. I also added jetty's maven dependency to pom file.
What should I do then to create servlet project?
Should I create webapp\WEB-INF\web.xml folder in main\java manually? or there is some maven plugins which I must add to Pom.xml file and after clicking install in Lifecycle, related folders and files will be created automatically?
Pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.c.helloWorldMavenServlet</groupId>
<artifactId>helloWorldMavenServlet</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.16.v20140903</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
I recommend to use maven archetype to create project:
org.apache.maven.archetypes:maven-archetype-webapp
Then you should create directory java in src/main,then right click-> Mark Directory As -> Sources Root.
By default, you have web.xml in version 2.3 so that's mean you cannot user CDI for example.
If you want to change it go to File->Project Structure->Facets(or Modules) and then delete Web Descriptor from Deployment Descriptors and then add new web.xml(+) and choose version 3.1.
I hope it should work. At this moment I don't know any other way to achieve that
I have three modules of a project, getting developed as two seperate jars and one WAR. WAR is referring to two other jar. Please see the details below-
1.processDAO-this is a java Project producing a jar(processDAO.jar)
2.ProcessModel-this is a java project producing a jar(processModel.jar). And in pom.xml it is referring (processDAO.jar)
3.ProcessWebApp-this is Main web app project as War producing (processWebApp.WAR). Now this is using (processModel.jar)
Now currently after each development when I need to build the WAR file I first build -(processDAO.jar)
then 2nd- processModel.jar
and in last I build ProcessWebApp.WAR
So each time I have to follow this sequential build process. Now, I want whenever I go to build my ProcessWebApp.WAR other dependency gets build automatically in same sequential manner(1->2->3).
Any advice on this will be very helpful.
Environment I am using Eclipse which have mavenplugin. I just right click on every project and do RunAs 'Maven install'.
1.processDAO.pom
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>processDAO</groupId>
<artifactId>processDAO</artifactId>
<version>2.0</version>
<packaging>jar</packaging>
2.ProcessModel.pom
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ProcessModel</groupId>
<artifactId>ProcessModel</artifactId>
<version>2.0</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>processDAO</groupId>
<artifactId>processDAO</artifactId>
<version>2.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
3.ProcessWebApp.pom
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ProcessWebApp</groupId>
<artifactId>ProcessWebApp</artifactId>
<version>2.0</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>ProcessModel</groupId>
<artifactId>ProcessModel</artifactId>
<version>2.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
Listen there several issues with the way you have created your pom or what you want to achieve.
A minor comment on the existing samples is to fix the <groupid> element usually it is something of com.xxx.my.company and is not identical with the artifact id.
Now from what I understand it seems that you are still changing the code on the dependent modules, so that means you are releasing SNAPSHOT versions (otherwise you wont need to check the compatibility of your libs every time right?). See this question on using xxx-SNAPSHOT here
Also check the use of the -U flag mvn clean install -U . See mvn -help.
-U,--update-snapshots Forces a check for missing
releases and updated snapshots on
remote repositories
This is usually achieved by use of a parent project POM, the only purpose of which is to build the modules that it depends on. When creating the POM, specify the packaging type as 'POM' and then specify your WAR and JARs as module elements. There's a pretty good example and description of this on Sonatype's site here.
I have created the sample maven project and it executes well as expected, however I would like to know the location of JUnit library.
I tried to find it in the local repository and my project path but I do not find the one.
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>com.maven.sample</groupId>
<artifactId>sampleproject</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>sampleproject</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Maven version: 3.3.9.
The file is certainly in your Maven cache, in the .m2/repository/junit/junit/3.8.1 folder, note the pattern: .m2/repository/<groupId>/<artifactId>/<version>
If you really want to have it automatically generated by Maven, use the Maven Dependency Plugin and its build-classpath goal.
From the command line on your project run:
mvn dependency:build-classpath
It will generate as part of the build output a list of paths for all the declared dependencies, so you will be sure where to look for.
Additionally, you can use the mdep.outputFile option to have it written to a file:
mvn dependency:build-classpath -Dmdep.outputFile=classpath.txt
I'm trying to use a SimpleMongoBolt from storm-contrib. I downloaded the source, entered the storm-contrib-mongo directory and ran mvn package and mvn install. Everything worked fine and IntelliJ was able to resolve things while coding. When I try to build my project, however, it tries to find a pom for this library on an external repository. When it can't find it, it fails. What do I need to do to 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>StormTest</groupId>
<artifactId>StormTest</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>StormTest</name>
<repositories>
<repository>
<id>clojars.org</id>
<url>http://clojars.org/repo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>storm</groupId>
<artifactId>storm</artifactId>
<version>0.7.2</version>
<scope>Test</scope>
</dependency>
<dependency>
<groupId>com.rapportive</groupId>
<artifactId>storm-amqp-spout</artifactId>
<version>0.1.1</version>
</dependency>
<dependency>
<groupId>com.rapportive</groupId>
<artifactId>storm-json</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>storm</groupId>
<artifactId>storm-contrib-mongo</artifactId>
<version>0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
You can try to check if you have proper dependencies defined in your project pom and compare them to storm artifact one. groupId, artifactId and version must be the same or Maven will try to download it from external repository and probably failed as it has never been installed on any public Maven repo.
When you install your artifact, it goes to user-directory/.m2/repostiory/group/id/path/*artifact/id/path*/version.
For your storm-amqp-spout you should have it in:
user-directory/.m2/repository/com/rapportive/storm-amqp-spout/0.1.1 folder.
There you should have few files:
jar itself (if it was packaged as jar file).
pom.xml file (the same you created for your project and you used to built and install it).
optionally sha1 files for both above.
If you don't have them, you probably made some mistake installing the artifact into repository. You can try to install it again or manually create pom just copying it from artifact source directory.
If there's correct pom.xml, I don't really have idea as I have never worked with IntelliJ (idea? ;)).
SimpleMongoBolt in Storm-Contrib was actually out of date. I updated the module myself and submitted a pull request, which has yet to be merged. Currently you can retrieve the updated code from my Storm-Contrib fork.
I've installed the following maven module to my local maven repository
EWS Maven Module but the IDE (Eclipse in this case) doesn't seem to know about the following class `GetUserAvailabilityRequest.
Interestingly, I can run a mvn compile on my project that uses the dependency above successfully.
I can even see the class file in the jar file under my Maven Dependencies in Eclipse.
Does anyone know why this might be occurring ?
Edit #tolitius:
ews-java is a dependency for my project, not the project I'm trying to import
Here is the pom file in question:
<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.conf</groupId>
<artifactId>conferenceclient</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>microsoft.exchange</groupId>
<artifactId>exchange-ws-api</artifactId>
<version>1.1.4-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Turns out that the class in question is not public. It had nothing to do with Maven or Eclipse or anything.I wasn't looking at the class since I didn't have the source attachment.