You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Zarick Lau <za...@gmail.com> on 2007/08/09 06:47:37 UTC

How to include the artfact/extraFiles/dependency in assembly (single module)

Dear users and developers,

I have a single module project, is it possible to create an assembly
such that, it include the normal project artifact, extra files (scripts/sql)
and dependency in the assembly output?

I can use an descriptor to include the scripts and dependencies
included in the output, but the module itself is not included.

For example:

After mvn package (I use assembly:inline),
I found the followings files in target/sample-1.0-SNAPSHOT-binary.dir:
bin/start.sh
lib/commons-logging-1.1.jar
lib/commons-lang-2.1.jar
[... some more other commonly used jar ...]


However, the sample-1.0-SNAPSHOT.jar is not appear in the directory.

How can I managed the sample-1.0-SNAPSHOT.jar appear in the directory?

== the following is my descriptor ==
<assembly>
	<id>binary</id>
	<formats>
		<format>zip</format>
	</formats>
	<baseDirectory>${artifactId}-${version}</baseDirectory>
	<includeBaseDirectory>true</includeBaseDirectory>

	<fileSets>
		<fileSet>
			<directory>src/main/script</directory>
			<filtered>false</filtered>
			<lineEnding>keep</lineEnding>
			<outputDirectory>scripts</outputDirectory>
			<useStrictFiltering>false</useStrictFiltering>
			<useDefaultExcludes>true</useDefaultExcludes>
			<fileMode>0555</fileMode>
			<directoryMode>0755</directoryMode>
		</fileSet>
	</fileSets>

	<dependencySets>
		<dependencySet>
			<outputDirectory>lib</outputDirectory>
		</dependencySet>
	</dependencySets>

</assembly>


Thanks!!

Zarick Lau

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


Re: How to include the artfact/extraFiles/dependency in assembly (single module)

Posted by Zarick Lau <za...@gmail.com>.
On 8/16/07, Bryan Noll <bw...@gmail.com> wrote:
> Zarick...
>
> Just wanted to let you know that your solution just helped me out.  I
> would second it that it seems odd to me that extra configuration is
> required in order to get the jar your project is building into the
> assembly.  Seems to me this should be the default behavior, and then the
> user could exclude if they wanted to.

Yes, total agreed :)

Zarick

>
> At any rate, thanks for posting your solution back to the board.
>
> --Bryan
>
> Zarick Lau wrote:
> > Alright, I got an answer myself. The solution is the add one more 'fileSet'
> > to include the artifact produced the jar plugin.
> >
> >   <fileSet>
> >     <includes>
> >       <include>${artifactId}-*.jar</include>
> >     </includes>
> >     <directory>${basedir}/target</directory>
> >     <outputDirectory>lib</outputDirectory>
> >     <lineEnding>keep</lineEnding>
> >     <fileMode>0664</fileMode>
> >   </fileSet>
> >
> > Btw, I think that, assembly plugin should include this setup as one of the
> > default assembly descriptor (as I think it is common enough, isn't it?)
> >
> > On 8/9/07, Zarick Lau <za...@gmail.com> wrote:
> >
> >> Dear users and developers,
> >>
> >> I have a single module project, is it possible to create an assembly
> >> such that, it include the normal project artifact, extra files (scripts/sql)
> >> and dependency in the assembly output?
> >>
> >> I can use an descriptor to include the scripts and dependencies
> >> included in the output, but the module itself is not included.
> >>
> >> For example:
> >>
> >> After mvn package (I use assembly:inline),
> >> I found the followings files in target/sample-1.0-SNAPSHOT-binary.dir:
> >> bin/start.sh
> >> lib/commons-logging-1.1.jar
> >> lib/commons-lang-2.1.jar
> >> [... some more other commonly used jar ...]
> >>
> >>
> >> However, the sample-1.0-SNAPSHOT.jar is not appear in the directory.
> >>
> >> How can I managed the sample-1.0-SNAPSHOT.jar appear in the directory?
> >>
> >> == the following is my descriptor ==
> >> <assembly>
> >>         <id>binary</id>
> >>         <formats>
> >>                 <format>zip</format>
> >>         </formats>
> >>         <baseDirectory>${artifactId}-${version}</baseDirectory>
> >>         <includeBaseDirectory>true</includeBaseDirectory>
> >>
> >>         <fileSets>
> >>                 <fileSet>
> >>                         <directory>src/main/script</directory>
> >>                         <filtered>false</filtered>
> >>                         <lineEnding>keep</lineEnding>
> >>                         <outputDirectory>scripts</outputDirectory>
> >>                         <useStrictFiltering>false</useStrictFiltering>
> >>                         <useDefaultExcludes>true</useDefaultExcludes>
> >>                         <fileMode>0555</fileMode>
> >>                         <directoryMode>0755</directoryMode>
> >>                 </fileSet>
> >>         </fileSets>
> >>
> >>         <dependencySets>
> >>                 <dependencySet>
> >>                         <outputDirectory>lib</outputDirectory>
> >>                 </dependencySet>
> >>         </dependencySets>
> >>
> >> </assembly>
> >>
> >>
> >> Thanks!!
> >>
> >> Zarick Lau
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > 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
>
>

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


Re: How to include the artfact/extraFiles/dependency in assembly (single module)

Posted by Bryan Noll <bw...@gmail.com>.
Zarick...

Just wanted to let you know that your solution just helped me out.  I 
would second it that it seems odd to me that extra configuration is 
required in order to get the jar your project is building into the 
assembly.  Seems to me this should be the default behavior, and then the 
user could exclude if they wanted to.

At any rate, thanks for posting your solution back to the board.

--Bryan

Zarick Lau wrote:
> Alright, I got an answer myself. The solution is the add one more 'fileSet'
> to include the artifact produced the jar plugin.
>
>   <fileSet>
>     <includes>
>       <include>${artifactId}-*.jar</include>
>     </includes>
>     <directory>${basedir}/target</directory>
>     <outputDirectory>lib</outputDirectory>
>     <lineEnding>keep</lineEnding>
>     <fileMode>0664</fileMode>
>   </fileSet>
>
> Btw, I think that, assembly plugin should include this setup as one of the
> default assembly descriptor (as I think it is common enough, isn't it?)
>
> On 8/9/07, Zarick Lau <za...@gmail.com> wrote:
>   
>> Dear users and developers,
>>
>> I have a single module project, is it possible to create an assembly
>> such that, it include the normal project artifact, extra files (scripts/sql)
>> and dependency in the assembly output?
>>
>> I can use an descriptor to include the scripts and dependencies
>> included in the output, but the module itself is not included.
>>
>> For example:
>>
>> After mvn package (I use assembly:inline),
>> I found the followings files in target/sample-1.0-SNAPSHOT-binary.dir:
>> bin/start.sh
>> lib/commons-logging-1.1.jar
>> lib/commons-lang-2.1.jar
>> [... some more other commonly used jar ...]
>>
>>
>> However, the sample-1.0-SNAPSHOT.jar is not appear in the directory.
>>
>> How can I managed the sample-1.0-SNAPSHOT.jar appear in the directory?
>>
>> == the following is my descriptor ==
>> <assembly>
>>         <id>binary</id>
>>         <formats>
>>                 <format>zip</format>
>>         </formats>
>>         <baseDirectory>${artifactId}-${version}</baseDirectory>
>>         <includeBaseDirectory>true</includeBaseDirectory>
>>
>>         <fileSets>
>>                 <fileSet>
>>                         <directory>src/main/script</directory>
>>                         <filtered>false</filtered>
>>                         <lineEnding>keep</lineEnding>
>>                         <outputDirectory>scripts</outputDirectory>
>>                         <useStrictFiltering>false</useStrictFiltering>
>>                         <useDefaultExcludes>true</useDefaultExcludes>
>>                         <fileMode>0555</fileMode>
>>                         <directoryMode>0755</directoryMode>
>>                 </fileSet>
>>         </fileSets>
>>
>>         <dependencySets>
>>                 <dependencySet>
>>                         <outputDirectory>lib</outputDirectory>
>>                 </dependencySet>
>>         </dependencySets>
>>
>> </assembly>
>>
>>
>> Thanks!!
>>
>> Zarick Lau
>>
>>     
>
> ---------------------------------------------------------------------
> 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


Re: How to include the artfact/extraFiles/dependency in assembly (single module)

Posted by Zarick Lau <za...@gmail.com>.
On 8/16/07, John Casey <jd...@commonjava.org> wrote:
> BTW, this problem is fixed in the latest snapshots of the assembly
> plugin, where there is a new flag in the assembly descriptor's
> dependencySet: <useProjectArtifact>true|false</useProjectArtifact>.
> For compatibility with the 2.1 release of maven-assembly-plugin, this
> flag is set to true by default.
>
> I know it's just trivia right now, but someday we'll get this next
> release out, and it'll be useful to know. :-)

Thanks for your update, John. Actually this /trivial thing/ cost me
hours to figure out (as I insist it should be work by default :), yes I'm
a little bit silly!)

Best regards,
Zarick Lauu

>
> -john
>
> On Aug 12, 2007, at 7:21 AM, Zarick Lau wrote:
>
> > Alright, I got an answer myself. The solution is the add one more
> > 'fileSet'
> > to include the artifact produced the jar plugin.
> >
> >   <fileSet>
> >     <includes>
> >       <include>${artifactId}-*.jar</include>
> >     </includes>
> >     <directory>${basedir}/target</directory>
> >     <outputDirectory>lib</outputDirectory>
> >     <lineEnding>keep</lineEnding>
> >     <fileMode>0664</fileMode>
> >   </fileSet>
> >
> > Btw, I think that, assembly plugin should include this setup as one
> > of the
> > default assembly descriptor (as I think it is common enough, isn't
> > it?)
> >
> > On 8/9/07, Zarick Lau <za...@gmail.com> wrote:
> >> Dear users and developers,
> >>
> >> I have a single module project, is it possible to create an assembly
> >> such that, it include the normal project artifact, extra files
> >> (scripts/sql)
> >> and dependency in the assembly output?
> >>
> >> I can use an descriptor to include the scripts and dependencies
> >> included in the output, but the module itself is not included.
> >>
> >> For example:
> >>
> >> After mvn package (I use assembly:inline),
> >> I found the followings files in target/sample-1.0-SNAPSHOT-
> >> binary.dir:
> >> bin/start.sh
> >> lib/commons-logging-1.1.jar
> >> lib/commons-lang-2.1.jar
> >> [... some more other commonly used jar ...]
> >>
> >>
> >> However, the sample-1.0-SNAPSHOT.jar is not appear in the directory.
> >>
> >> How can I managed the sample-1.0-SNAPSHOT.jar appear in the
> >> directory?
> >>
> >> == the following is my descriptor ==
> >> <assembly>
> >>         <id>binary</id>
> >>         <formats>
> >>                 <format>zip</format>
> >>         </formats>
> >>         <baseDirectory>${artifactId}-${version}</baseDirectory>
> >>         <includeBaseDirectory>true</includeBaseDirectory>
> >>
> >>         <fileSets>
> >>                 <fileSet>
> >>                         <directory>src/main/script</directory>
> >>                         <filtered>false</filtered>
> >>                         <lineEnding>keep</lineEnding>
> >>                         <outputDirectory>scripts</outputDirectory>
> >>                         <useStrictFiltering>false</
> >> useStrictFiltering>
> >>                         <useDefaultExcludes>true</useDefaultExcludes>
> >>                         <fileMode>0555</fileMode>
> >>                         <directoryMode>0755</directoryMode>
> >>                 </fileSet>
> >>         </fileSets>
> >>
> >>         <dependencySets>
> >>                 <dependencySet>
> >>                         <outputDirectory>lib</outputDirectory>
> >>                 </dependencySet>
> >>         </dependencySets>
> >>
> >> </assembly>
> >>
> >>
> >> Thanks!!
> >>
> >> Zarick Lau
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
>
> ---
> John Casey
> Committer and PMC Member, Apache Maven
> mail: jdcasey at commonjava dot org
> blog: http://www.ejlife.net/blogs/john
>
>
>

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


Re: How to include the artfact/extraFiles/dependency in assembly (single module)

Posted by Bryan Noll <bw...@gmail.com>.
Thanks for following up and letting us know John.  Good info.

John Casey wrote:
> BTW, this problem is fixed in the latest snapshots of the assembly 
> plugin, where there is a new flag in the assembly descriptor's 
> dependencySet: <useProjectArtifact>true|false</useProjectArtifact>. 
> For compatibility with the 2.1 release of maven-assembly-plugin, this 
> flag is set to true by default.
>
> I know it's just trivia right now, but someday we'll get this next 
> release out, and it'll be useful to know. :-)
>
> -john
>
> On Aug 12, 2007, at 7:21 AM, Zarick Lau wrote:
>
>> Alright, I got an answer myself. The solution is the add one more 
>> 'fileSet'
>> to include the artifact produced the jar plugin.
>>
>>   <fileSet>
>>     <includes>
>>       <include>${artifactId}-*.jar</include>
>>     </includes>
>>     <directory>${basedir}/target</directory>
>>     <outputDirectory>lib</outputDirectory>
>>     <lineEnding>keep</lineEnding>
>>     <fileMode>0664</fileMode>
>>   </fileSet>
>>
>> Btw, I think that, assembly plugin should include this setup as one 
>> of the
>> default assembly descriptor (as I think it is common enough, isn't it?)
>>
>> On 8/9/07, Zarick Lau <za...@gmail.com> wrote:
>>> Dear users and developers,
>>>
>>> I have a single module project, is it possible to create an assembly
>>> such that, it include the normal project artifact, extra files 
>>> (scripts/sql)
>>> and dependency in the assembly output?
>>>
>>> I can use an descriptor to include the scripts and dependencies
>>> included in the output, but the module itself is not included.
>>>
>>> For example:
>>>
>>> After mvn package (I use assembly:inline),
>>> I found the followings files in target/sample-1.0-SNAPSHOT-binary.dir:
>>> bin/start.sh
>>> lib/commons-logging-1.1.jar
>>> lib/commons-lang-2.1.jar
>>> [... some more other commonly used jar ...]
>>>
>>>
>>> However, the sample-1.0-SNAPSHOT.jar is not appear in the directory.
>>>
>>> How can I managed the sample-1.0-SNAPSHOT.jar appear in the directory?
>>>
>>> == the following is my descriptor ==
>>> <assembly>
>>>         <id>binary</id>
>>>         <formats>
>>>                 <format>zip</format>
>>>         </formats>
>>>         <baseDirectory>${artifactId}-${version}</baseDirectory>
>>>         <includeBaseDirectory>true</includeBaseDirectory>
>>>
>>>         <fileSets>
>>>                 <fileSet>
>>>                         <directory>src/main/script</directory>
>>>                         <filtered>false</filtered>
>>>                         <lineEnding>keep</lineEnding>
>>>                         <outputDirectory>scripts</outputDirectory>
>>>                         <useStrictFiltering>false</useStrictFiltering>
>>>                         <useDefaultExcludes>true</useDefaultExcludes>
>>>                         <fileMode>0555</fileMode>
>>>                         <directoryMode>0755</directoryMode>
>>>                 </fileSet>
>>>         </fileSets>
>>>
>>>         <dependencySets>
>>>                 <dependencySet>
>>>                         <outputDirectory>lib</outputDirectory>
>>>                 </dependencySet>
>>>         </dependencySets>
>>>
>>> </assembly>
>>>
>>>
>>> Thanks!!
>>>
>>> Zarick Lau
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>
> ---
> John Casey
> Committer and PMC Member, Apache Maven
> mail: jdcasey at commonjava dot org
> blog: http://www.ejlife.net/blogs/john
>
>
>

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


Re: How to include the artfact/extraFiles/dependency in assembly (single module)

Posted by John Casey <jd...@commonjava.org>.
BTW, this problem is fixed in the latest snapshots of the assembly  
plugin, where there is a new flag in the assembly descriptor's  
dependencySet: <useProjectArtifact>true|false</useProjectArtifact>.  
For compatibility with the 2.1 release of maven-assembly-plugin, this  
flag is set to true by default.

I know it's just trivia right now, but someday we'll get this next  
release out, and it'll be useful to know. :-)

-john

On Aug 12, 2007, at 7:21 AM, Zarick Lau wrote:

> Alright, I got an answer myself. The solution is the add one more  
> 'fileSet'
> to include the artifact produced the jar plugin.
>
>   <fileSet>
>     <includes>
>       <include>${artifactId}-*.jar</include>
>     </includes>
>     <directory>${basedir}/target</directory>
>     <outputDirectory>lib</outputDirectory>
>     <lineEnding>keep</lineEnding>
>     <fileMode>0664</fileMode>
>   </fileSet>
>
> Btw, I think that, assembly plugin should include this setup as one  
> of the
> default assembly descriptor (as I think it is common enough, isn't  
> it?)
>
> On 8/9/07, Zarick Lau <za...@gmail.com> wrote:
>> Dear users and developers,
>>
>> I have a single module project, is it possible to create an assembly
>> such that, it include the normal project artifact, extra files  
>> (scripts/sql)
>> and dependency in the assembly output?
>>
>> I can use an descriptor to include the scripts and dependencies
>> included in the output, but the module itself is not included.
>>
>> For example:
>>
>> After mvn package (I use assembly:inline),
>> I found the followings files in target/sample-1.0-SNAPSHOT- 
>> binary.dir:
>> bin/start.sh
>> lib/commons-logging-1.1.jar
>> lib/commons-lang-2.1.jar
>> [... some more other commonly used jar ...]
>>
>>
>> However, the sample-1.0-SNAPSHOT.jar is not appear in the directory.
>>
>> How can I managed the sample-1.0-SNAPSHOT.jar appear in the  
>> directory?
>>
>> == the following is my descriptor ==
>> <assembly>
>>         <id>binary</id>
>>         <formats>
>>                 <format>zip</format>
>>         </formats>
>>         <baseDirectory>${artifactId}-${version}</baseDirectory>
>>         <includeBaseDirectory>true</includeBaseDirectory>
>>
>>         <fileSets>
>>                 <fileSet>
>>                         <directory>src/main/script</directory>
>>                         <filtered>false</filtered>
>>                         <lineEnding>keep</lineEnding>
>>                         <outputDirectory>scripts</outputDirectory>
>>                         <useStrictFiltering>false</ 
>> useStrictFiltering>
>>                         <useDefaultExcludes>true</useDefaultExcludes>
>>                         <fileMode>0555</fileMode>
>>                         <directoryMode>0755</directoryMode>
>>                 </fileSet>
>>         </fileSets>
>>
>>         <dependencySets>
>>                 <dependencySet>
>>                         <outputDirectory>lib</outputDirectory>
>>                 </dependencySet>
>>         </dependencySets>
>>
>> </assembly>
>>
>>
>> Thanks!!
>>
>> Zarick Lau
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

---
John Casey
Committer and PMC Member, Apache Maven
mail: jdcasey at commonjava dot org
blog: http://www.ejlife.net/blogs/john



Re: How to include the artfact/extraFiles/dependency in assembly (single module)

Posted by Zarick Lau <za...@gmail.com>.
Alright, I got an answer myself. The solution is the add one more 'fileSet'
to include the artifact produced the jar plugin.

  <fileSet>
    <includes>
      <include>${artifactId}-*.jar</include>
    </includes>
    <directory>${basedir}/target</directory>
    <outputDirectory>lib</outputDirectory>
    <lineEnding>keep</lineEnding>
    <fileMode>0664</fileMode>
  </fileSet>

Btw, I think that, assembly plugin should include this setup as one of the
default assembly descriptor (as I think it is common enough, isn't it?)

On 8/9/07, Zarick Lau <za...@gmail.com> wrote:
> Dear users and developers,
>
> I have a single module project, is it possible to create an assembly
> such that, it include the normal project artifact, extra files (scripts/sql)
> and dependency in the assembly output?
>
> I can use an descriptor to include the scripts and dependencies
> included in the output, but the module itself is not included.
>
> For example:
>
> After mvn package (I use assembly:inline),
> I found the followings files in target/sample-1.0-SNAPSHOT-binary.dir:
> bin/start.sh
> lib/commons-logging-1.1.jar
> lib/commons-lang-2.1.jar
> [... some more other commonly used jar ...]
>
>
> However, the sample-1.0-SNAPSHOT.jar is not appear in the directory.
>
> How can I managed the sample-1.0-SNAPSHOT.jar appear in the directory?
>
> == the following is my descriptor ==
> <assembly>
>         <id>binary</id>
>         <formats>
>                 <format>zip</format>
>         </formats>
>         <baseDirectory>${artifactId}-${version}</baseDirectory>
>         <includeBaseDirectory>true</includeBaseDirectory>
>
>         <fileSets>
>                 <fileSet>
>                         <directory>src/main/script</directory>
>                         <filtered>false</filtered>
>                         <lineEnding>keep</lineEnding>
>                         <outputDirectory>scripts</outputDirectory>
>                         <useStrictFiltering>false</useStrictFiltering>
>                         <useDefaultExcludes>true</useDefaultExcludes>
>                         <fileMode>0555</fileMode>
>                         <directoryMode>0755</directoryMode>
>                 </fileSet>
>         </fileSets>
>
>         <dependencySets>
>                 <dependencySet>
>                         <outputDirectory>lib</outputDirectory>
>                 </dependencySet>
>         </dependencySets>
>
> </assembly>
>
>
> Thanks!!
>
> Zarick Lau
>

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