You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Suneet Shah <su...@gmail.com> on 2009/10/26 17:33:43 UTC

Creating a new Goal

Hello:

I am realitively new to maven and could use some guidance on the 
following task.

I have project that current has a mixture of spring and hibernate 
objects which I can build fine using maven.
However for another task, I need to create a jar that contains only the 
DTO and Interface classes from the first project above.

Whats the best way to approach this? Can I create a new goal like "jar" 
to extract and package this? If so, how do I do it?
Alternatively, I can split the project into two. One that contains just 
the DTO and interfaces and the other which contains the implementations 
of these interfaces.

Thanks for your help


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


Re: Create zip of multi-module project

Posted by Michael Remijan <mj...@yahoo.com>.
What's in the descriptor is simple and as far as I can tell has nothing to do with the error.

<assembly>
  <id>source-release</id>
  <formats>
    <format>zip</format>
  </formats>
  <fileSets>
    <!-- main project directory structure -->
    <fileSet>
      <directory>.</directory>
      <outputDirectory>/</outputDirectory>
      <useDefaultExcludes>true</useDefaultExcludes>
      <excludes>
        <!-- build output -->
        <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/).*${project.build.directory}.*]</exclude>
      </excludes>
    </fileSet>
  </fileSets>
</assembly>




________________________________
From: Nick Stolwijk <ni...@gmail.com>
To: Maven Users List <us...@maven.apache.org>
Sent: Mon, October 26, 2009 4:25:10 PM
Subject: Re: Create zip of multi-module project

And what do you have in your descriptor?

With regards,

Nick Stolwijk
~Java Developer~

IPROFS BV.
Claus Sluterweg 125
2012 WS Haarlem
http://www.iprofs.nl


On Mon, Oct 26, 2009 at 10:59 PM, Michael Remijan <mj...@yahoo.com>wrote:

> src/assemblies/source-release.xml
>

Re: Create zip of multi-module project

Posted by Nick Stolwijk <ni...@gmail.com>.
And what do you have in your descriptor?

With regards,

Nick Stolwijk
~Java Developer~

IPROFS BV.
Claus Sluterweg 125
2012 WS Haarlem
http://www.iprofs.nl


On Mon, Oct 26, 2009 at 10:59 PM, Michael Remijan <mj...@yahoo.com>wrote:

> src/assemblies/source-release.xml
>

Re: Create zip of multi-module project

Posted by Michael Remijan <mj...@yahoo.com>.
The configuration of the assembly-plugin in the project pom is what's giving me problems.  I tried this.

  <build>
    <plugins>
             <!-- 
              | This plugin configuration is responsible for
              | creating binary distribution ZIP file which
              | users can download, upzip, and easily execute.
              -->            
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>            
                    <execution>                    
                        <id>assemble</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>                            
                                <descriptor>src/assemblies/source-release.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin> 
        </plugins>
  </build>


but it errors because it's looking for a JAR file from the project POM.

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to create assembly: Error adding file to archive: C:\workspace\timeserver\target\timeserver-parent-0.0.1.jar isn't a file.




________________________________
From: Nick Stolwijk <ni...@gmail.com>
To: Maven Users List <us...@maven.apache.org>
Sent: Mon, October 26, 2009 3:25:37 PM
Subject: Re: Create zip of multi-module project

Forget what I said, you only want the sources so you can run it from the
project pom. Take a look at the assembly descriptor of the maven project
itself.

[1]
http://svn.apache.org/repos/asf/maven/resources/tags/apache-source-release-assembly-descriptor-1.0.1/src/main/resources/assemblies/source-release.xml

Hth,

Nick Stolwijk
~Java Developer~

IPROFS BV.
Claus Sluterweg 125
2012 WS Haarlem
http://www.iprofs.nl


On Mon, Oct 26, 2009 at 10:21 PM, Nick Stolwijk <ni...@gmail.com>wrote:

> Yes, try again. ;) The assembly plugin is what you want, just remember that
> the project pom will be build before the others, so you can't attach the
> assembly plugin to that one. You will need an extra module, which depends on
> all the others and create it from there.
>
> Hth,
>
> Nick Stolwijk
> ~Java Developer~
>
> IPROFS BV.
> Claus Sluterweg 125
> 2012 WS Haarlem
> http://www.iprofs.nl
>
>
>
> On Mon, Oct 26, 2009 at 10:19 PM, Michael Remijan <mj...@yahoo.com>wrote:
>
>> I have a multi-module project and at the project POM level (not the module
>> level) I want to create a a zip of the entire multi-module project excluding
>> the common stuff like CVS dirs and target dirs. I've tried configuring the
>> assembly plugin but haven't been able to get it to work.  Any ideas?
>
>
>

Re: Create zip of multi-module project

Posted by Nick Stolwijk <ni...@gmail.com>.
Forget what I said, you only want the sources so you can run it from the
project pom. Take a look at the assembly descriptor of the maven project
itself.

[1]
http://svn.apache.org/repos/asf/maven/resources/tags/apache-source-release-assembly-descriptor-1.0.1/src/main/resources/assemblies/source-release.xml

Hth,

Nick Stolwijk
~Java Developer~

IPROFS BV.
Claus Sluterweg 125
2012 WS Haarlem
http://www.iprofs.nl


On Mon, Oct 26, 2009 at 10:21 PM, Nick Stolwijk <ni...@gmail.com>wrote:

> Yes, try again. ;) The assembly plugin is what you want, just remember that
> the project pom will be build before the others, so you can't attach the
> assembly plugin to that one. You will need an extra module, which depends on
> all the others and create it from there.
>
> Hth,
>
> Nick Stolwijk
> ~Java Developer~
>
> IPROFS BV.
> Claus Sluterweg 125
> 2012 WS Haarlem
> http://www.iprofs.nl
>
>
>
> On Mon, Oct 26, 2009 at 10:19 PM, Michael Remijan <mj...@yahoo.com>wrote:
>
>> I have a multi-module project and at the project POM level (not the module
>> level) I want to create a a zip of the entire multi-module project excluding
>> the common stuff like CVS dirs and target dirs. I've tried configuring the
>> assembly plugin but haven't been able to get it to work.  Any ideas?
>
>
>

Re: Create zip of multi-module project

Posted by Nick Stolwijk <ni...@gmail.com>.
Yes, try again. ;) The assembly plugin is what you want, just remember that
the project pom will be build before the others, so you can't attach the
assembly plugin to that one. You will need an extra module, which depends on
all the others and create it from there.

Hth,

Nick Stolwijk
~Java Developer~

IPROFS BV.
Claus Sluterweg 125
2012 WS Haarlem
http://www.iprofs.nl


On Mon, Oct 26, 2009 at 10:19 PM, Michael Remijan <mj...@yahoo.com>wrote:

> I have a multi-module project and at the project POM level (not the module
> level) I want to create a a zip of the entire multi-module project excluding
> the common stuff like CVS dirs and target dirs. I've tried configuring the
> assembly plugin but haven't been able to get it to work.  Any ideas?

Create zip of multi-module project

Posted by Michael Remijan <mj...@yahoo.com>.
I have a multi-module project and at the project POM level (not the module level) I want to create a a zip of the entire multi-module project excluding the common stuff like CVS dirs and target dirs. I've tried configuring the assembly plugin but haven't been able to get it to work.  Any ideas?

Re: Creating a new Goal

Posted by Suneet Shah <su...@gmail.com>.
Thanks Justin and Stephen.

This is very helpful feedback. We will split up the project


Stephen Connolly wrote:
> producing two jars from the same project is a bad plan.
>
> both jars will have the same dependencies, which is almost always 
> exactly what you do not want
>
> better to split the project in to 2, 3, or 4 projects as necessary. 
> not that splitting the project will likely expose elements of bad design.
>
> for example, we had a module which we cannot split because the 
> logically separate parts have circular references (our old ant based 
> build would rebuild the module n! times where n is the number of jar 
> files in our build... this was to be sure to be sure that the circular 
> refs were linking correctly... bootstrapping the build was a nightmare 
> as you needed all the jars to build all the jars... this is very bad 
> design)
>
> when mavenizing we could have gone two ways:
>
> 1. lump all the source into one tree and selectivle build each jar 
> with includes/excludes
>
> 2. bite the bullet, refactor to remove the circular dependencies and 
> split out into n modules.
>
> we went for option two, and in the process of refactoring we went from 
> n to n+m modules, the additional modules contain interfaces which are 
> used (with DI) to break the circular deps
>
> our code is cleaner, and the build is simpler.
>
> don't fight maven, split into separate modules
>
> Sent from my [rhymes with tryPod] ;-)
>
> On 26 Oct 2009, at 17:06, "Edelson, Justin" 
> <Ju...@mtvstaff.com> wrote:
>
>> You can do this with a second execution of the jar plugin, assuming
>> there's some easy way to identify the DTO and Interface classes (i.e. by
>> package/path or file name). See
>> http://maven.apache.org/plugins/maven-jar-plugin/usage.html. There was
>> some discussion last week about potential issues with creating two JARs
>> from the same source tree, so you might also want to look at the list
>> archives. If it's relatively trivial to break your project into two,
>> that will likely have some additional upside, if not now than in the
>> future.
>>
>> Justin
>>
>> -----Original Message-----
>> From: Suneet Shah [mailto:suneetshah2000@gmail.com]
>> Sent: Monday, October 26, 2009 12:34 PM
>> To: users@maven.apache.org
>> Subject: Creating a new Goal
>>
>> Hello:
>>
>> I am realitively new to maven and could use some guidance on the
>> following task.
>>
>> I have project that current has a mixture of spring and hibernate
>> objects which I can build fine using maven.
>> However for another task, I need to create a jar that contains only the
>> DTO and Interface classes from the first project above.
>>
>> Whats the best way to approach this? Can I create a new goal like "jar"
>> to extract and package this? If so, how do I do it?
>> Alternatively, I can split the project into two. One that contains just
>> the DTO and interfaces and the other which contains the implementations
>> of these interfaces.
>>
>> Thanks for your help
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>

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


Re: Creating a new Goal

Posted by Stephen Connolly <st...@gmail.com>.
producing two jars from the same project is a bad plan.

both jars will have the same dependencies, which is almost always  
exactly what you do not want

better to split the project in to 2, 3, or 4 projects as necessary.  
not that splitting the project will likely expose elements of bad  
design.

for example, we had a module which we cannot split because the  
logically separate parts have circular references (our old ant based  
build would rebuild the module n! times where n is the number of jar  
files in our build... this was to be sure to be sure that the circular  
refs were linking correctly... bootstrapping the build was a nightmare  
as you needed all the jars to build all the jars... this is very bad  
design)

when mavenizing we could have gone two ways:

1. lump all the source into one tree and selectivle build each jar  
with includes/excludes

2. bite the bullet, refactor to remove the circular dependencies and  
split out into n modules.

we went for option two, and in the process of refactoring we went from  
n to n+m modules, the additional modules contain interfaces which are  
used (with DI) to break the circular deps

our code is cleaner, and the build is simpler.

don't fight maven, split into separate modules

Sent from my [rhymes with tryPod] ;-)

On 26 Oct 2009, at 17:06, "Edelson, Justin"  
<Ju...@mtvstaff.com> wrote:

> You can do this with a second execution of the jar plugin, assuming
> there's some easy way to identify the DTO and Interface classes  
> (i.e. by
> package/path or file name). See
> http://maven.apache.org/plugins/maven-jar-plugin/usage.html. There was
> some discussion last week about potential issues with creating two  
> JARs
> from the same source tree, so you might also want to look at the list
> archives. If it's relatively trivial to break your project into two,
> that will likely have some additional upside, if not now than in the
> future.
>
> Justin
>
> -----Original Message-----
> From: Suneet Shah [mailto:suneetshah2000@gmail.com]
> Sent: Monday, October 26, 2009 12:34 PM
> To: users@maven.apache.org
> Subject: Creating a new Goal
>
> Hello:
>
> I am realitively new to maven and could use some guidance on the
> following task.
>
> I have project that current has a mixture of spring and hibernate
> objects which I can build fine using maven.
> However for another task, I need to create a jar that contains only  
> the
> DTO and Interface classes from the first project above.
>
> Whats the best way to approach this? Can I create a new goal like  
> "jar"
> to extract and package this? If so, how do I do it?
> Alternatively, I can split the project into two. One that contains  
> just
> the DTO and interfaces and the other which contains the  
> implementations
> of these interfaces.
>
> Thanks for your help
>
>
> ---------------------------------------------------------------------
> 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: Creating a new Goal

Posted by "Edelson, Justin" <Ju...@mtvstaff.com>.
You can do this with a second execution of the jar plugin, assuming
there's some easy way to identify the DTO and Interface classes (i.e. by
package/path or file name). See
http://maven.apache.org/plugins/maven-jar-plugin/usage.html. There was
some discussion last week about potential issues with creating two JARs
from the same source tree, so you might also want to look at the list
archives. If it's relatively trivial to break your project into two,
that will likely have some additional upside, if not now than in the
future.

Justin

-----Original Message-----
From: Suneet Shah [mailto:suneetshah2000@gmail.com] 
Sent: Monday, October 26, 2009 12:34 PM
To: users@maven.apache.org
Subject: Creating a new Goal

Hello:

I am realitively new to maven and could use some guidance on the
following task.

I have project that current has a mixture of spring and hibernate
objects which I can build fine using maven.
However for another task, I need to create a jar that contains only the
DTO and Interface classes from the first project above.

Whats the best way to approach this? Can I create a new goal like "jar" 
to extract and package this? If so, how do I do it?
Alternatively, I can split the project into two. One that contains just
the DTO and interfaces and the other which contains the implementations
of these interfaces.

Thanks for your help


---------------------------------------------------------------------
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