Need help with maven example

eclipse, eclipse-plugin, java, maven-2, maven-plugin

Solution

You're invoking `exec:exec` instead of `exec:java`.

The goals section should be `exec:java`, and in the JRE tab and the `-Dexec.mainClass=...` argument.

Problem

I'm trying to learn maven ASAP as its required for my current work place. I found this great book which pretty much explains everything about maven. I'm using eclipse for java development and I installed maven eclipse plugin, in the book I mentioned above there is example(which may or may not be relevant) 4.2.1. Yahoo! Weather RSS. Purpose of this example is to ilustrate how maven works in a slightly more complex way, by connecting to the yahoo weather rss server and getting the appropriate data from it. With what I struggle is this line below,I manage to execute it from cmd(I'm using win-7) ``` mvn exec:java -Dexec.mainClass=org.sonatype.mavenbook.weather.Main ``` When I use text editor and cmd, first to edit files and second to perform commands with maven I do everything as in the book everything runs perfectly, but we work with eclipse so I'd like to learn how to do the same with eclipse. How do I do this from eclipse? Here is the image of what I try to run : alt text http://postavi.com/hosted/bc0de2440ba2b5017a92672c721dcca1.gif So I get to the next screen : alt text http://postavi.com/hosted/5c79320f64e850879d49823c4a6e2ecb.gif I run it and I get this error : ``` Version: 1.1.1 Mojo: exec brought in via: Direct invocation While building project: Group-Id: org.sonatype.mavenbook.custom Artifact-Id: weather Version: 0.0.1-SNAPSHOT From file: C:\OPR-CS\weather\pom.xml Missing parameters include: executable [INFO] ------------------------------------------------------------------------ [INFO] For more information, run with the -e flag [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILED [INFO] ------------------------------------------------------------------------ [INFO] Total time: < 1 second [INFO] Finished at: Tue Feb 02 14:47:04 CET 2010 [INFO] Final Memory: 1M/7M [INFO] ------------------------------------------------------------------------ ``` I assume I didn't pass the appropriate parameteres as it says in error above. ``` -Dexec.mainClass=org.sonatype.mavenbook.weather.Main ``` This line above. Because I don't know how. Here is the pom.xml file, same as in book slightly adjusted here it 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.sonatype.mavenbook.custom</groupId> <artifactId>weather</artifactId> <packaging>jar</packaging> <version>0.0.1-SNAPSHOT</version> <name>weather</name> <url>http://maven.apache.org</url> <licenses> <license> <name>Apache 2</name> <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> <distribution>repo</distribution> <comments>A business-friendly OSS license</comments> </license> </licenses> <organization> <name>ORIGIGI</name> <url>http://www.devs.com</url> </organization> <developers> <developer> <id>emco</id> <name>Myself and I</name> <email>devs@devs.com</email> <url>http://www.devs.com</url> <organization>ORIGIGI</organization> <organizationUrl>http://www.devs.com</organizationUrl> <roles> <role>developer</role> </roles> <timezone>-6</timezone> </developer> </developers> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.14</version> </dependency> <dependency> <groupId>dom4j</groupId> <artifactId>dom4j</artifactId> <version>1.6.1</version> </dependency> <dependency> <groupId>jaxen</groupId> <artifactId>jaxen</artifactId> <version>1.1.1</version> </dependency> <dependency> <groupId>velocity</groupId> <artifactId>velocity</artifactId> <version>1.5</version> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> </plugins> </build> </project> ``` Can anyone help me? Thank you

Original source