Zeba,

It's probably not Maven best practice to have a .jar file with no classifier 
popped out of a pom project.  But I'll let the Maven experts discuss that.

I think you can accomplish what you want with multiple executions, something 
like this maybe.  This is just a guess so YMMV.

      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.3</version>
        <executions>
          <execution>
            <id>make-bin</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
                                <descriptors>
                                        
<descriptor>assembly-bin.xml</descriptor>
                                </descriptors>
                     <appendAssemblyId>false</appendAssemblyId>
            </configuration>
          </execution>
          <execution>
            <id>make-sources</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
                                <descriptors>
                                        
<descriptor>assembly-sources.xml</descriptor>
                                </descriptors>
                     <appendAssemblyId>true</appendAssemblyId>
            </configuration>
          </execution>
        </executions>
      </plugin>

Good luck.

-Jim

-----Original Message-----
From: zebahmad [mailto:[email protected]] 
Sent: Saturday, March 24, 2012 9:37 AM
To: [email protected]
Subject: Assembly plugin with multiple XMLs - appending assembly ID

I'm using the assembly plugin to create two assemblies for a deliverable -
one for the binary and one for sources

DeliverableX
--| ProjectA
--| ProjectB

So on invoking maven build of DeliverableX, projects A & B will be built and
assembly plugin is used to create two artifacts
DeliverableX-bin.jar
DeliverableX-sources.jar

Corresponding pom configuration entry for the plugin:
                         <configuration>
                                <descriptors>
                                        
<descriptor>assembly-bin.xml</descriptor>
                                        
<descriptor>assembly-sources.xml</descriptor>
                                </descriptors>
                        <appendAssemblyId>true</appendAssemblyId>
                        </configuration>


assembly-bin.xml file:
<id>bin</id>
  <formats>
    <format>jar</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <dependencySets>
    <dependencySet>
      <outputDirectory>/</outputDirectory>
      <useProjectArtifact>true</useProjectArtifact>
      <includes>
        <include>com.mycompany.myproject.ProjectA:jar:1.0.3</include>
        <include>com.mycompany.myproject.ProjectB:jar:1.0.3</include>
      </includes>
      <unpack>true</unpack>
      <scope>runtime</scope>
    </dependencySet>
  </dependencySets>
</assembly>

Correspondingn assembly-sources.xml file:
  <id>sources</id>
  <formats>
    <format>jar</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <dependencySets>
    <dependencySet>
      <outputDirectory>/</outputDirectory>
      <useProjectArtifact>true</useProjectArtifact>
      <includes>
        <include>*:sources</include>
      </includes>
      <unpack>true</unpack>
      <scope>runtime</scope>
    </dependencySet>
  </dependencySets>
</assembly>


My problem is that I want the final artifacts to be DeliverableX.jar and
DeliverableX-sources.jar, similar to normal maven conventions. By the above
script I get DeliverableX-bin.jar and DeliverableX-sources.jar. If I change
the value of <appendAssemblyId> then that gets changed for both the assembly
files. 

Any suggestion the best way to handle this?

Thanking you in advance!!! :)

Zeba


--
View this message in context: 
http://maven.40175.n5.nabble.com/Assembly-plugin-with-multiple-XMLs-appending-assembly-ID-tp5591772p5591772.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to