Well, we are migrating a very old project from ant to maven. It is a multi
module project (ca. 17 modules). We can already compile and use the whole
project, so we are sure that our new maven "multi-module-structure" works
right. The next target is that the project should be delivered as a set of
defined artifacts. These artifacts are: *.jars, *.xmls, *.xsds,
*.properties, javadocs etc. files from particular subprojects. They should
be ordered in the defined directory structure:
/root
- directory1
- artifact1
- artifact2
- ...
- directory2
- artifact1
- artifact2
...
So my thoughts was: if I have a multi module project I should take a
moduleSet from an assembly plugin. And how you know it didn't work...
Our project structure looks like this:
/project
- module1
pom.xml
- module2
pom.xml
- moduleX
pom.xml
(parent)pom.xml
Parent POM is also referenced in the child POM's. How I configured my
assembly plugin you can read in the first e-mail...
Dmitriy
2011/5/1 Ron Wheeler <[email protected]>
> What are you trying to build?
> Unless you are building something that is really off-beat, you should just
> be able to follow best practices.
>
> Most people do not need to do what you are doing.
>
> You seem to heading down a bizarre development path that is likely not
> needed and going to set up a complex and fragile build system.
> Maven has Best Practices for all kinds of applications (from webapps to
> batch jobs to desktop apps) with sizes that range from 1 module to hundreds.
> Very few of them involve anything as complex as what you are building.
>
> You might take a minute to describe what you are trying to build and see if
> you get a simple solution.
>
> One of the problems in this forum is that some of the guys here can make
> Maven do almost anything.
> If you ask them a detailed technical question with no context, you will get
> a perfectly correct response that moves you forward.
> If you are going down the wrong path, rapid progress is not necessarily in
> your best interest.
>
> Take a step back and let the forum know what you are trying to build and
> how your sources are structured.
>
> Ron
>
>
> On 01/05/2011 9:50 AM, Dmitriy Neretin wrote:
>
>> I need not only dependenciesSets, but also fileSets...
>>
>> 2011/4/28 Anders Hammar<[email protected]>
>>
>> You should not traverse the file structure but rely on dependencies! It
>>> should work building when just checking out this specific module from
>>> scm.
>>>
>>> /Anders
>>>
>>> On Thu, Apr 28, 2011 at 18:01, Dmitriy Neretin<
>>> [email protected]> wrote:
>>>
>>> Holy sh... :)) Of cource it works :) But it is not really that what I
>>>> wanted
>>>> but it's not important now :) Thank you very much. But I still don't
>>>> understand why the moduleSet didn't work... Strange (How old is the
>>>> maven
>>>> documentation????). With this variable ${project.parent.basedir} I can
>>>>
>>> get
>>>
>>>> access on parent directory structure. So I hope to solve my problems
>>>> completly!
>>>>
>>>> Have a nice day!
>>>>
>>>> 2011/4/28 Anders Hammar<[email protected]>
>>>>
>>>> No, you should not use moduleSet but dependencySet (or similar, I'm not
>>>>>
>>>> at
>>>>
>>>>> my computer and cannot check syntax).
>>>>>
>>>>> /Anders (mobile)
>>>>> Den 28 apr 2011 17.14 skrev "Dmitriy Neretin"<
>>>>> [email protected]>:
>>>>>
>>>>>> Well I just removed the assembly declaration from the parent POM. I
>>>>>>
>>>>> just
>>>>
>>>>> left there the new distribution module. When I change to the
>>>>>>
>>>>> distribution
>>>>
>>>>> folder and execute mvn assembly:single or mvn clean package I get
>>>>>>
>>>>> this:
>>>
>>>> [INFO] Reading assembly descriptor: config/assembly.xml
>>>>>> [WARNING] The following patterns were never triggered in this
>>>>>>
>>>>> artifact
>>>
>>>> inclusion filter:
>>>>>> o 'A'
>>>>>>
>>>>>> [WARNING] The following patterns were never triggered in this
>>>>>>
>>>>> artifact
>>>
>>>> inclusion filter:
>>>>>> o 'A'
>>>>>>
>>>>>> [WARNING] NOTE: Currently, inclusion of module dependencies may
>>>>>>
>>>>> produce
>>>
>>>> unpredictable results if a version conflict occu
>>>>>> rs.
>>>>>> [INFO]
>>>>>>
>>>>>> ------------------------------------------------------------------------
>>>>
>>>>> [ERROR] BUILD ERROR
>>>>>> [INFO]
>>>>>>
>>>>>> ------------------------------------------------------------------------
>>>>
>>>>> [INFO] Failed to create assembly: Error creating assembly archive
>>>>>>
>>>>> test:
>>>
>>>> You
>>>>>
>>>>>> must set at least one file.
>>>>>>
>>>>>> Well the descriptor war reas only once, but we still see the double
>>>>>>
>>>>> warning
>>>>>
>>>>>> about failed trigger :(
>>>>>>
>>>>>> But the assembly configuration is right:
>>>>>>
>>>>>> <moduleSets>
>>>>>> <moduleSet>
>>>>>> <useAllReactorProjects>true</useAllReactorProjects>
>>>>>> <includes>
>>>>>> <include>A</include>
>>>>>> </includes>
>>>>>> <binaries>
>>>>>> <outputDirectory>tools/caseviewer</outputDirectory>
>>>>>> <unpack>false</unpack>
>>>>>> </binaries>
>>>>>> </moduleSet>
>>>>>> </moduleSets>
>>>>>>
>>>>>>
>>>>>> 2011/4/28 Anders Hammar<[email protected]>
>>>>>>
>>>>>> Ok, the log output indicates that the assembly is executed twice
>>>>>>>
>>>>>> (there
>>>>
>>>>> is
>>>>>
>>>>>> a
>>>>>>> warning about the same id used twice).
>>>>>>> Start by removing any assembly configuration from your parent, to
>>>>>>>
>>>>>> keep
>>>
>>>> things simple. Just add it yo your module. When you get that to work
>>>>>>>
>>>>>> you
>>>>
>>>>> could start by doing advanced stuff.
>>>>>>>
>>>>>>> /Anders
>>>>>>>
>>>>>>> On Thu, Apr 28, 2011 at 15:37, Dmitriy Neretin<
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>> Thanks for the reply!
>>>>>>>>
>>>>>>>> 2011/4/28 Anders Hammar<[email protected]>
>>>>>>>>
>>>>>>>> The "declaration" in your parent, is that a binding? Or is it in
>>>>>>>>> pluginManagement?
>>>>>>>>>
>>>>>>>>> Well I don't really understand what do you mean with binding :)
>>>>>>>>
>>>>>>> The
>>>
>>>> assembly
>>>>>>>> plugin is declared between the<plugins/> tags:
>>>>>>>>
>>>>>>>> <plugins>
>>>>>>>> <plugin>
>>>>>>>> Assembly declaration
>>>>>>>> </plugin>
>>>>>>>> </plugins>
>>>>>>>>
>>>>>>>>
>>>>>>>> Why are configuring the descriptor in the parent? Are you trying
>>>>>>>>>
>>>>>>>> to
>>>>
>>>>> make
>>>>>>>
>>>>>>>> an
>>>>>>>>
>>>>>>>>> assembly in the parent as well as in the child?
>>>>>>>>>
>>>>>>>>> I configure the descriptor in the parent because I have read this
>>>>>>>>
>>>>>>> under
>>>>>
>>>>>> the
>>>>>>>
>>>>>>>> link below (maven documentation). And I am not really shure it is
>>>>>>>>
>>>>>>> right...
>>>>>>>
>>>>>>>> I
>>>>>>>> am trying now to make an assembly from the child project but the
>>>>>>>>
>>>>>>> main
>>>>
>>>>> target
>>>>>>>> is preety simple: After compiling (mvn install) of the whole
>>>>>>>>
>>>>>>> project
>>>
>>>> (from
>>>>>>>
>>>>>>>> the parent level) I want to find in the distribution directory
>>>>>>>>
>>>>>>> some
>>>
>>>> artifacts like binaries, some skripts, zips etc. I have already
>>>>>>>>
>>>>>>> used
>>>
>>>> this
>>>>>
>>>>>> plugin for a child project to build a zip file and it worked :(
>>>>>>>>
>>>>>>>> /Anders
>>>>>>>>> On Thu, Apr 28, 2011 at 15:03, Dmitriy Neretin<
>>>>>>>>> [email protected]> wrote:
>>>>>>>>>
>>>>>>>>> Hello everybody,
>>>>>>>>>>
>>>>>>>>>> I have a problem with the assembly plugin. I used the
>>>>>>>>>>
>>>>>>>>> following
>>>
>>>> documentation:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>
>>> http://maven.apache.org/plugins/maven-assembly-plugin/examples/multimodule/module-binary-inclusion-simple.html
>>>
>>>> I created the additional module to keep my assembly in the
>>>>>>>>>>
>>>>>>>>> parent
>>>>
>>>>> POM:
>>>>>>>
>>>>>>>> ...
>>>>>>>>>> <modules>
>>>>>>>>>> <module>A</module>
>>>>>>>>>> <module>B</module>
>>>>>>>>>> <module>C</module>
>>>>>>>>>> <module>distribution</module>
>>>>>>>>>> </modules>
>>>>>>>>>> ...
>>>>>>>>>>
>>>>>>>>>> and declared the assembly plugin in the parent POM:
>>>>>>>>>>
>>>>>>>>>> <plugin>
>>>>>>>>>> <groupId>org.apache.maven.plugins</groupId>
>>>>>>>>>> <artifactId>maven-assembly-plugin</artifactId>
>>>>>>>>>> <version>2.2.1</version>
>>>>>>>>>> <configuration>
>>>>>>>>>> <descriptor>config/assembly.xml</descriptor>
>>>>>>>>>> </configuration>
>>>>>>>>>> </plugin>
>>>>>>>>>>
>>>>>>>>>> after that I declared the new POM in the distribution
>>>>>>>>>>
>>>>>>>>> directory
>>>
>>>> where
>>>>>
>>>>>> I
>>>>>>>
>>>>>>>> also
>>>>>>>>>> referenced the parent POM:
>>>>>>>>>>
>>>>>>>>>> <parent>
>>>>>>>>>> <groupId>GROUPNAME</groupId>
>>>>>>>>>> <artifactId>NAME</artifactId>
>>>>>>>>>> <version>VERSION</version>
>>>>>>>>>> <relativePath>../pom.xml</relativePath>
>>>>>>>>>> </parent>
>>>>>>>>>>
>>>>>>>>>> and also declared the assembly plugin:
>>>>>>>>>>
>>>>>>>>>> <plugin>
>>>>>>>>>> <artifactId>maven-assembly-plugin</artifactId>
>>>>>>>>>> <executions>
>>>>>>>>>> <execution>
>>>>>>>>>> <id>create-assembly</id>
>>>>>>>>>> <phase>package</phase>
>>>>>>>>>> <goals>
>>>>>>>>>> <goal>single</goal>
>>>>>>>>>> </goals>
>>>>>>>>>> <configuration>
>>>>>>>>>> <descriptors>
>>>>>>>>>> <descriptor>config/assembly.xml</descriptor>
>>>>>>>>>> </descriptors>
>>>>>>>>>> </configuration>
>>>>>>>>>> </execution>
>>>>>>>>>> </executions>
>>>>>>>>>> </plugin>
>>>>>>>>>>
>>>>>>>>>> The assembly.xml is placed in the distribution/config
>>>>>>>>>>
>>>>>>>>> directory
>>>
>>>> and
>>>>>
>>>>>> looks
>>>>>>>>
>>>>>>>>> like this:
>>>>>>>>>>
>>>>>>>>>> <id>test</id>
>>>>>>>>>>
>>>>>>>>>> <formats>
>>>>>>>>>> <format>dir</format>
>>>>>>>>>> </formats>
>>>>>>>>>>
>>>>>>>>>> <includeBaseDirectory>false</includeBaseDirectory>
>>>>>>>>>> <moduleSets>
>>>>>>>>>> <moduleSet>
>>>>>>>>>> <useAllReactorProjects>true</useAllReactorProjects>
>>>>>>>>>> <includes>
>>>>>>>>>> <include>A</include>
>>>>>>>>>> </includes>
>>>>>>>>>> <binaries>
>>>>>>>>>> <outputDirectory>TOOLS</outputDirectory>
>>>>>>>>>> <unpack>false</unpack>
>>>>>>>>>> </binaries>
>>>>>>>>>> </moduleSet>
>>>>>>>>>> </moduleSets>
>>>>>>>>>>
>>>>>>>>>> If I execute mvn clean package I get following error message:
>>>>>>>>>>
>>>>>>>>>> [INFO] Reading assembly descriptor: config/assembly.xml
>>>>>>>>>> [WARNING] The assembly id test is used more than once.
>>>>>>>>>> [WARNING] The following patterns were never triggered in this
>>>>>>>>>>
>>>>>>>>> artifact
>>>>>>>
>>>>>>>> inclusion filter:
>>>>>>>>>> o 'A'
>>>>>>>>>>
>>>>>>>>>> [WARNING] The following patterns were never triggered in this
>>>>>>>>>>
>>>>>>>>> artifact
>>>>>>>
>>>>>>>> inclusion filter:
>>>>>>>>>> o 'A'
>>>>>>>>>>
>>>>>>>>>> [WARNING] NOTE: Currently, inclusion of module dependencies
>>>>>>>>>>
>>>>>>>>> may
>>>
>>>> produce
>>>>>>>
>>>>>>>> unpredictable results if a version conflict occu
>>>>>>>>>> rs.
>>>>>>>>>> [INFO]
>>>>>>>>>>
>>>>>>>>>> ------------------------------------------------------------------------
>>>
>>>> [ERROR] BUILD ERROR
>>>>>>>>>> [INFO]
>>>>>>>>>>
>>>>>>>>>> ------------------------------------------------------------------------
>>>
>>>> [INFO] Failed to create assembly: Error creating assembly
>>>>>>>>>>
>>>>>>>>> archive
>>>>
>>>>> test:
>>>>>>>
>>>>>>>> You
>>>>>>>>>
>>>>>>>>>> must set at least one file.
>>>>>>>>>>
>>>>>>>>>> [INFO]
>>>>>>>>>>
>>>>>>>>>> ------------------------------------------------------------------------
>>>
>>>> If I execute mvn assembly:single then the message that
>>>>>>>>>>
>>>>>>>>> assembly
>>>
>>>> id
>>>>
>>>>> used
>>>>>>>
>>>>>>>> more
>>>>>>>>>> than once disappears.
>>>>>>>>>> I use Maven 2.2.1 on WinXp Pro
>>>>>>>>>>
>>>>>>>>>> Can somebody help me?
>>>>>>>>>>
>>>>>>>>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>