Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

i can't solve maven building error failure

Tags:

java

maven

I get a error when I use maven to build my project.so please help! thank you for your help

Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2.1:assembly (make-assembly) on project newstart-app-ithelp: Execution make-assembly of goal org.apache.maven.plugins:maven-assembly-plugin:2.2.1:assembly failed: For artifact {null:null:null:jar}: The groupId cannot be empty. cause : Execution make-assembly of goal org.apache.maven.plugins:maven-assembly-plugin:2.2.1:assembly failed: For artifact {null:null:null:jar}: The groupId cannot be empty. Stack trace : org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2.1:assembly (make-assembly) on project newstart-app-ithelp: Execution make-assembly of goal org.apache.maven.plugins:maven-assembly-plugin:2.2.1:assembly failed: For artifact {null:null:null:jar}: The groupId cannot be empty.

<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">
<parent>
    <groupId>com.feinno.app</groupId>
    <artifactId>root-pom</artifactId>
    <version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>newstart.app</groupId>
<artifactId>newstart-app-ithelp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>newstart-app-ithelp</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.2.1</version>
            <configuration>
                <appendAssemblyId>false</appendAssemblyId>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
                <archive>
                    <manifest>
                        <mainClass>com.newstart.app.ithelp.ITHelpBean</mainClass>
                    </manifest>
                </archive>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>assembly</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <verbose>true</verbose>
                <fork>true</fork>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <skip>true</skip>
            </configuration>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.4.3</version>
    </dependency>
    <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.16</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.1.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpmime</artifactId>
        <version>4.1.2</version>
    </dependency>
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.0</version>
    </dependency>
    <dependency>
        <groupId>com.feinno.app</groupId>
        <artifactId>feinno-app-common</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.quartz-scheduler</groupId>
        <artifactId>quartz</artifactId>
        <version>2.2.0</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.24</version>
    </dependency>
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>druid</artifactId>
        <version>0.2.9</version>
    </dependency>
    <dependency>
        <groupId>spring-aop</groupId>
        <artifactId>spring-aop</artifactId>
        <version>3.2.3</version>
    </dependency>
    <dependency>
        <groupId>spring-beans</groupId>
        <artifactId>spring-beans</artifactId>
        <version>3.2.3</version>
    </dependency>
    <dependency>
        <groupId>spring-context</groupId>
        <artifactId>spring-context</artifactId>
        <version>3.2.3</version>
    </dependency>
    <dependency>
        <groupId>spring-core</groupId>
        <artifactId>spring-core</artifactId>
        <version>3.2.3</version>
    </dependency>
    <dependency>
        <groupId>spring-jdbc</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>3.2.3</version>
    </dependency>
    <dependency>
        <groupId>spring-tx</groupId>
        <artifactId>spring-tx</artifactId>
        <version>3.2.3</version>
    </dependency>
    <dependency>
        <groupId>spring-expression</groupId>
        <artifactId>spring-expression</artifactId>
        <version>3.2.3</version>
    </dependency>
    <dependency>
        <groupId>IKAnalyzer</groupId>
        <artifactId>IKAnalyzer</artifactId>
        <version>6</version>
    </dependency>
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.lucene</groupId>
        <artifactId>lucene-core</artifactId>
        <version>3.6.0</version>
    </dependency>
    <dependency>
        <groupId>net.sf.ehcache</groupId>
        <artifactId>ehcache-core</artifactId>
        <version>2.6.0</version>
    </dependency>
    <dependency>
        <groupId>linq4j</groupId>
        <artifactId>linq4j</artifactId>
        <version>1.0</version>
    </dependency>
</dependencies>
<distributionManagement>
    <snapshotRepository>
        <id>snapshots</id>
        <url>http://10.10.208.92:8081/content/repositories/snapshots</url>
    </snapshotRepository>
</distributionManagement>

like image 309
user2317894 Avatar asked Jan 17 '14 10:01

user2317894


People also ask

How do I resolve MojoExecutionException?

The MojoExecutionException should not appear after that. Some Eclipse versions have this problem to refresh the target folder. In this case, Refresh the project just after the "Maven Install".

What is the command for Maven build?

To build a Maven project via the command line, you use the mvn command from the command line. The command must be executed in the directory which contains the relevant pom file. You pass the build life cycle, phase or goal as parameter to this command.


2 Answers

I have fixed this issue by deleting local .m2/repository folder. The build is successful now.

like image 161
brownfox Avatar answered Sep 18 '22 09:09

brownfox


And mine has a different solution. I had a POM that had a <dependencyManagement> entry for the jar without any <version>, and it had a <dependencies> entry for the jar with a <version>. Plus, the parent POM had a <dependencyManagement> entry with the same <version>. Apparently this confused Maven (3.3). The build worked fine, but the packaging did not.

Fix: remove <dependencyManagement> entry in the child POM, and remove the <version> from the <dependencies> entry in the child POM.

In code, here is the broken situation:

Parent pom.xml:
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${httpclient.version}</version>
        </dependency>
    </dependencies>
</dependencyManagement>

Child pom.xml:
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
        </dependency>
    </dependencies>
</dependencyManagement>
...
<dependencies>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>${httpclient.version}</version>
    </dependency>
</dependencies>

Post fix: parent POM is the same, child pom has just this

<dependencies>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
    </dependency>
</dependencies>
like image 25
Spencer Avatar answered Sep 19 '22 09:09

Spencer