Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Learning Maven: "Unable to parse configuration" for jar plugin

I am attempting to learn maven on a small project of my own, using eclipse. I converted the existing project to the maven standard directory configuration, and it was building; now I'm trying to get maven to produce the jar for the application. The following is pom.xml:

<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>       com.rc          </groupId>
    <artifactId>    SpaceCheck      </artifactId>
    <version>       0.9.1-SNAPSHOT  </version>
    <name>          SpaceCheck      </name>
    <packaging>     jar             </packaging>

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

    <build>
        <plugins>
              <plugin>
                  <groupId>   org.apache.maven.plugins </groupId>
                  <artifactId>maven-jar-plugin         </artifactId>
                  <version>   2.3.2                    </version>
                  <configuration>
                <includes>**/src/*</includes>
                      <archive>
                          <manifest>
                              <addClasspath>true</addClasspath>
                              <classpathPrefix>lib/</classpathPrefix>
                              <mainClass>spacecheck.SpaceCheck</mainClass>
                          </manifest>
                      </archive>
                  </configuration>
              </plugin>
        </plugins>
    </build>

</project>

I didn't use to have the 'includes' clause; as near as I can tell, that's what the example I got pointed to told me to do to fix the problem. It does not.

When I attempt to build, I get:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.2:jar (default-jar) on project SpaceCheck: Unable to parse configuration of mojo org.apache.maven.plugins:maven-jar-plugin:2.3.2:jar for parameter includes: Cannot assign configuration entry 'includes' with value '*/src/' of type java.lang.String to property of type java.lang.String[] -> [Help 1]

The "Help 1" link points me to the tutorial that I followed to get this far.

The problem I have with the tutorial is that it doesn't explain how things work -- it gives you an example and expects you to extract general workings from the example. There's nothing wrong with examples, but they rarely match exactly what one wants to do.

I'm sure many people can tell me what's wrong, and I would appreciate it. But it would be even better if they could ALSO tell me where this is explained, not just where there is an example that does something similar. The explanation, to be complete, would explain what element needs to be added, just where in the XML that goes, and what the various options are for the thing that goes there.

like image 707
arcy Avatar asked Dec 22 '13 23:12

arcy


1 Answers

Instead of

<includes>**/src/*</includes>

try

<includes>
    <include>**/src/*</include>
</includes>

And if you are learning Maven you definitely want to check out The Complete Reference.

like image 109
Joachim Rohde Avatar answered Oct 01 '22 05:10

Joachim Rohde