maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim McCaskey <jim.mccas...@pervasive.com>
Subject RE: Assembly plugin with multiple XMLs - appending assembly ID
Date Mon, 26 Mar 2012 00:45:12 GMT
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:coolzebs@gmail.com] 
Sent: Saturday, March 24, 2012 9:37 AM
To: users@maven.apache.org
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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message