views:

177

answers:

1

I am trying to release a web project using Maven 2.2.1 and the maven-release-plugin 2.0-beta-9, but it always fails when doing release:perform on generating the sources jar for the EAR project, which makes sense since the EAR project doesn't have any source.

[INFO] [INFO] [source:jar {execution: attach-sources}]
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] BUILD ERROR
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Error creating source archive: You must set at least one file.

To try to disable the building of a sources JAR for the EAR project, I added the following to the POM for my EAR project (the version of the release plugin is set in a parent POM):

<build>
    <plugins>
        ...
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <configuration>
                <useReleaseProfile>false</useReleaseProfile>
            </configuration>
        </plugin>
    </plugins>
</build>

Upon running the release again after checking in this change, I got the same error while generating the sources JAR for the EAR project, even though this should have been disabled by the previous POM snippet.

What am I doing wrong? Why is the sources JAR still being built?

Edit: I've tried to make the source plugin include my application.xml file so that this error doesn't occur by adding the following POM snippet:

<build>
    <plugins>
        ...
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <configuration>
                <includes>
                    <include>${basedir}/META-INF/**/*</include>
                </includes>
                <useDefaultExcludes>false</useDefaultExcludes>
            </configuration>
        </plugin>
    </plugins>
</build>

Unfortunately, this does not fix the problem either.

A: 

I finally figured it out. I needed to add my source files as part of the references:

<resources>
    <resource>
        <directory>${project.basedir}</directory>
        <includes>
            <include>META-INF/**/*</include>
        </includes>
        <excludes>
            <exclude>target/**/*</exclude>
            <exclude>bin/**/*</exclude>
            <exclude>META-INF/.svn/**/*</exclude>
        </excludes>
    </resource>
</resources>

Doing this made everything work again. I didn't need any special configuration for the release or source plugins to get it to work.

Chris Lieb