0

I created a maven project with eclipse and made jar file from it with this below comand

mvn package

when i try to know my mvn project config is true or not with this command

mvn exec:java -D exec.mainClass="giraph.helloworld.App"

i get this error :

failed to execute goal
org.codehaus.mojo:exec-maven-plugin:1.2.1:java(default-cli) on project helloworld: An exception occured while executing the java class. null: InvocationTargetException: No arguments were provided

POM.xml setting of project is as follows. I will be so grateful if anyone can help me and specifies the reasons of this error?

  <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>giraph</groupId>   
    <artifactId>helloworld</artifactId>  
    <version>0.0.1-SNAPSHOT</version>   
    <packaging>jar</packaging>

    <name>helloworld</name>   
    <url>http://maven.apache.org</url>

    <properties>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>            
     </properties>

    <dependencies>      
    <dependency>
        <groupId>org.apache.giraph</groupId>
        <artifactId>giraph-core</artifactId>
        <version>1.1.0</version>    
    </dependency>       
    <dependency>    
        <groupId>org.apache.maven.plugins</groupId>  
        <artifactId>maven-compiler-plugin</artifactId>  
        <version>2.0.2</version>    
    </dependency>       
   <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-core</artifactId>
        <version>1.2.1</version>
   </dependency>    
   <dependency>     
    <groupId>org.apache.maven.plugins</groupId>  
    <artifactId>maven-surefire-plugin</artifactId>  
    <version>2.10</version>
   </dependency>  
 </dependencies>
 <build> 
   <plugins>
     <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.2.1</version>
        <executions>
        <execution>
          <goals>
            <goal>java</goal>
          </goals>
         <configuration>
           <mainClass>giraph.helloworld.App</mainClass>
         </configuration>
        </execution>
       </executions>
     </plugin>
  </plugins>
 </build> 
</project>
12
  • How are you creating the manifest file for your project? Commented Feb 13, 2017 at 1:30
  • I add mainClass in POM file using exec-maven-plugin. I think POM file acts like a manifest . is it true? Commented Feb 13, 2017 at 1:46
  • POM is supposed to generate that but there are some things missing in your POM. Check this out - mkyong.com/maven/how-to-create-a-manifest-file-with-maven Commented Feb 13, 2017 at 1:47
  • Also, if you can, please post your manifest file Commented Feb 13, 2017 at 1:47
  • I dont see manifest file in my POM file. is it exist in my project? Commented Feb 13, 2017 at 1:52

1 Answer 1

1

I think the problem is that your manifest file does not contain information about the entry point (the main class) of your jar. See Setting an Application entry point.

There are many ways to rectify this problem. You can use maven assembly plugin. For more details, check here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.