Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven assembly:assembly

Hello I am trying to create a custom descriptor ref in my parent pom which packages all dependencies with sources. I got the assembly.xml nailed down pretty well, but when I add it to my base POM assembly:assembly fails like so:

[INFO] [assembly:assembly]
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error reading assemblies: No assembly descriptors found.

[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error reading assemblies: No assembly descriptors found.

But assembly:single seems to work correctly. I've tried adding the jar-with-dependencies ref into the POM as well, but I am not sure if this is even possible.

Here is what I have in my base pom:

<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.2-beta-3</version>
    <dependencies>
        <dependency>
            <groupId>mycompany.jar.assembly</groupId>
            <artifactId>jar-with-dependencies-and-sources-test</artifactId>
            <version>1.0.0-SNAPSHOT</version>
        </dependency>
    </dependencies>
    <executions>
        <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
            <configuration>
                <descriptors>
                    <descriptor>assembly.xml</descriptor>
                </descriptors>
            </configuration>
        </execution>
    </executions>
</plugin>

Does anyone out there know who to get this to work when I invoke mvn assembly:assembly from the command line?

Thanks in advance.

like image 370
javamonkey79 Avatar asked Jun 09 '09 01:06

javamonkey79


People also ask

What is an assembly maven?

The Assembly Plugin for Maven enables developers to combine project output into a single distributable archive that also contains dependencies, modules, site documentation, and other files. Your project can easily build distribution "assemblies" using one of the prefabricated assembly descriptors.

What is fileset in Maven?

Defines the rules for matching and working with files in a given base directory. Element.

Where is Assembly XML?

The default location of assemblies. xml is in the project root directory.

Which of the following is a type of Maven Assembly plugin's built in descriptors?

bin. Use bin as the descriptorRef of your assembly-plugin configuration in order to create a binary distribution archive of your project. This built-in descriptor produces an assembly with the classifier bin in three archive formats: tar.


1 Answers

I'm not sure, but I have a suspicion. You define assembly:single as part of the package phase, and identify the descriptor there in the execution element. This may mean the plugin doesn't know where to look for the descriptor when you run assembly:assembly. Try copying your <configuration> element to outside of the <executions> element.

One of my poms looks like this, and I use assembly:assembly all the time:

<plugin>
  <artifactId>maven-assembly-plugin</artifactId>
  <version>2.1</version> 
  <configuration>
    <finalName>myJar</finalName>
    <descriptors>
      <descriptor>src/main/config/descriptor.xml</descriptor>
    </descriptors>
    <archive>
      <manifest>
        <mainClass>org.foo.Bar</mainClass>
      </manifest>
    </archive>
  </configuration>
</plugin> 

Note src/main/config isn't a Maven standard path, but I haven't defined any special handling of it.

like image 170
super_aardvark Avatar answered Oct 02 '22 21:10

super_aardvark