Announcement Announcement Module
Collapse
No announcement yet.
failed to load main-class manifest attribute from maven Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • failed to load main-class manifest attribute from maven

    hI @ALL;

    I'm trying to creat a jar file with Maven, but when i try to execut my jar file i get this error :
    failed to load main-class manifest attribute from maven

    this is my pom config

    Code:
    <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>spring</groupId>
      <artifactId>spring</artifactId>
      <version>0.0.1-SNAPSHOT</version>
    
      <dependencies>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-beans</artifactId>
      		<version>3.0.5.RELEASE</version>
      	</dependency>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-context</artifactId>
      		<version>3.0.5.RELEASE</version>
      	</dependency>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-context-support</artifactId>
      		<version>3.0.5.RELEASE</version>
      	</dependency>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-core</artifactId>
      		<version>3.0.5.RELEASE</version>
      	</dependency>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring</artifactId>
      		<version>2.5.6</version>
      	</dependency>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-aop</artifactId>
      		<version>3.0.5.RELEASE</version>
      	</dependency>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-asm</artifactId>
      		<version>3.0.5.RELEASE</version>
      	</dependency>
      	<dependency>
      		<groupId>org.springframework</groupId>
      		<artifactId>spring-expression</artifactId>
      		<version>3.0.5.RELEASE</version>
      	</dependency>
      	<dependency>
      		<groupId>log4j</groupId>
      		<artifactId>log4j</artifactId>
      		<version>1.2.16</version>
      	</dependency>
      </dependencies>
       <build>
        <sourceDirectory>src</sourceDirectory>
        <resources>
          <resource>
            <directory>src</directory>
            <excludes>
              <exclude>**/*.java</exclude>
            </excludes>
          </resource>
        </resources>
        <pluginManagement>
        <plugins>
          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.0</version>
            <configuration>
              <source/>
              <target/>
            </configuration>
          </plugin>
          <plugin>
          	<groupId>org.apache.maven.plugins</groupId>
           	<artifactId>maven-dependency-plugin</artifactId> 
            <configuration>
               <archive>
                <manifest>
                  <classpathPrefix>${env.CTCH_JAVA_DIR}</classpathPrefix>
                  <mainClass>fr.spring.Runner</mainClass>
                </manifest>
              </archive>
            </configuration>
          </plugin>
          <plugin>
    		<groupId>org.apache.maven.plugins</groupId>
    		<artifactId>maven-dependency-plugin</artifactId>
    		<version>2.5.1</version>
    		<executions>
    		  <execution>
    			<id>copy-dependencies</id>
    			<phase>package</phase>
    			<goals>
    				<goal>copy-dependencies</goal>
    			</goals>
    			<configuration>
    				<includeGroupIds>log4j</includeGroupIds>
    				<outputDirectory>target/dependency-jars/</outputDirectory>
    			</configuration>
    		  </execution>
    		 </executions>
    		</plugin>
        </plugins>
        </pluginManagement>
      </build>
    </project>
    the command line is :
    Code:
    mvn compile
    Code:
    mvn jar:jar
    Code:
    cd target
    Code:
    java -jar spring-0.0.1-SNAPSHOT.jar

  • #2
    1. Never mix spring versions (you are mixing 2.5.6 and 3.0)
    2. You have twice configured the dependency plugin, why?
    3. There is nothing on your classpath only your own jar. No spring or what so ever is available...

    Comment


    • #3
      Originally posted by Marten Deinum View Post
      1. Never mix spring versions (you are mixing 2.5.6 and 3.0)
      2. You have twice configured the dependency plugin, why?
      3. There is nothing on your classpath only your own jar. No spring or what so ever is available...
      Thank you for your reply, concerning my issue i'm new to spring and maven so plz could u give me the correct configuration

      Comment

      Working...
      X