Hi,
I hoping someone on this mailer can help with the following. I'm a newbie
to Eclipse & Maven and this may be a basic question but I'm trying to build
a single executable Jar file that will include project dependencies so for
this I'm using m2eclipse a maven plugin for eclipse. So here is where I'm
at present.
The project has two main java files and one test file (default test and
main file through using m2eclipse new project wizard). I added my own class
namely the following
*package VxcExperience.Selenium.Example.SeleniumDemoTests;
import java.net.URL;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.Point;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class RemoteWebDriverTest
{
public static void main(String[] args) throws Exception
{
WebDriver driver = new RemoteWebDriver(new URL("
http://10.53.59.247:4444/wd/hub"), DesiredCapabilities.firefox());
driver.get("http://www.google.com");
driver.manage().window().setPosition(new Point(100, 100));
driver.manage().window().maximize();
driver.manage().window().setSize(new Dimension(600, 600));
}
}*
As you can see per the above this class would have dependency on Selenium
packages which I used m2eclipse to resolve and am able to run as a Java
application within the IDE. Namely all the selenium libraries are located
under Maven Dependencies within package explorer. So far OK. But what I'm
trying to do is export it to a single Jar file that would have references
to selenium dependencies within it so that i can essentially drop on
another users machine and run like the following from a command line:
*java -classpath <NameOfJar>.jar
VxcExperience.Selenium.Example.SeleniumDemoTests.RemoteWebDriverTest*
However, this never works as the built jar doesn't include the Selenium
references from viewing the package using 7-zip. But if i tried the sample
that is created using the wizard for example
*java -classpath <NameOfJar>.jar
VxcExperience.Selenium.Example.SeleniumDemoTests.App*
it prints hello world. I wonder what I'm trying to do is achievable using
eclipse and m2eclipse or am I missing a step? I believe m2eclipse to be the
tool to use to bundle up dependencies into a runnable single jar file.
Sorry to spam the wrong mailer if this is not the right place to ask this
question but I'd appreciate any guidance given. Thanks in advance. Btw my
pom.xml looks like the following
*<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>VxcExperience.Selenium.Example</groupId>
<artifactId>SeleniumDemoTests-Project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>SeleniumDemoTests-Project</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.21.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>*
Kind Regards,
-Bhréin
_______________________________________________
m2e-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/m2e-users