You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Kamran Yadav <ka...@gmail.com> on 2010/11/22 06:17:29 UTC

maven to build thin war

Hi,

I am a first time user of Maven. Earlier used Ant and now migrating the
project to Maven. My environment is apache-maven-3.0, JDK 1.6.0_22 on
Windows 7 platform. I am trying to build a web application. I have following
issues -


   - The web app have 1500 Java files. The compilation takes over 15
   minutes. Is there anyway to speed up because when I was using ant it was
   building in just over 5 minutes. My config -

                                       <plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<minmemory>128m</minmemory>
<maxmemory>1024m</maxmemory>
</configuration>
</plugin>

   - The war file includes all the classes also but I don't want. I
   tried <archiveClasses>true</archiveClasses> also but then it includes the
   generated jar. I don't want that either.
   - Also I am using war:exploded in the command line still it creates a war
   file.


Thanks
Bhushan

Re: maven to build thin war

Posted by Kamran Yadav <ka...@gmail.com>.
As mentioned in the first point the compilation of 1500 files is taking
time.

On Mon, Nov 22, 2010 at 12:54 PM, Kalpak Gadre <ka...@gmail.com> wrote:

>  Hi Kamaran,
>
> It would help if you provide build log. Check what part in the build is
> taking too long.
>
> Thanks,
>
> Kalpak
>
>
>
>  Hi,
>>
>> I am a first time user of Maven. Earlier used Ant and now migrating the
>> project to Maven. My environment is apache-maven-3.0, JDK 1.6.0_22 on
>> Windows 7 platform. I am trying to build a web application. I have
>> following
>> issues -
>>
>>
>>    - The web app have 1500 Java files. The compilation takes over 15
>>    minutes. Is there anyway to speed up because when I was using ant it
>> was
>>    building in just over 5 minutes. My config -
>>
>>                                        <plugin>
>> <artifactId>maven-compiler-plugin</artifactId>
>> <version>2.0</version>
>> <configuration>
>> <source>1.6</source>
>> <target>1.6</target>
>> <minmemory>128m</minmemory>
>> <maxmemory>1024m</maxmemory>
>> </configuration>
>> </plugin>
>>
>>    - The war file includes all the classes also but I don't want. I
>>    tried<archiveClasses>true</archiveClasses>  also but then it includes
>> the
>>    generated jar. I don't want that either.
>>    - Also I am using war:exploded in the command line still it creates a
>> war
>>    file.
>>
>>
>> Thanks
>> Bhushan
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: maven to build thin war

Posted by Kalpak Gadre <ka...@gmail.com>.
  Hi Kamaran,

It would help if you provide build log. Check what part in the build is 
taking too long.

Thanks,

Kalpak


> Hi,
>
> I am a first time user of Maven. Earlier used Ant and now migrating the
> project to Maven. My environment is apache-maven-3.0, JDK 1.6.0_22 on
> Windows 7 platform. I am trying to build a web application. I have following
> issues -
>
>
>     - The web app have 1500 Java files. The compilation takes over 15
>     minutes. Is there anyway to speed up because when I was using ant it was
>     building in just over 5 minutes. My config -
>
>                                         <plugin>
> <artifactId>maven-compiler-plugin</artifactId>
> <version>2.0</version>
> <configuration>
> <source>1.6</source>
> <target>1.6</target>
> <minmemory>128m</minmemory>
> <maxmemory>1024m</maxmemory>
> </configuration>
> </plugin>
>
>     - The war file includes all the classes also but I don't want. I
>     tried<archiveClasses>true</archiveClasses>  also but then it includes the
>     generated jar. I don't want that either.
>     - Also I am using war:exploded in the command line still it creates a war
>     file.
>
>
> Thanks
> Bhushan
>


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


Re: maven to build thin war

Posted by Antonio Petrelli <an...@gmail.com>.
2010/11/22 Kamran Yadav <ka...@gmail.com>:
> I am using 2.3.2 now but no improvement.
>
> I understand I can create a separate project for the classes only but that
> is not in my control.
>
> Anyway is there anyway to produce the compiled class outside of
> target/classes folder as in say C:\etc.etc.

It's possible, but it won't help avoiding to include them in the war
package. If you want to exclude something from the war, take a look at
this:
http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html#packagingExcludes
However this is highly discouraged: it's best not to fight Maven but
to follow conventions and best practices.

Antonio

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


Re: maven to build thin war

Posted by Ron Wheeler <rw...@artifact-software.com>.
Sticking with Ant is not a bad thing but making these changes will help 
in the long run.

Ron


On 22/11/2010 9:50 PM, Kamran Yadav wrote:
> Thanks everybody
>
> The project is legacy so cannot be changed easily. But surely whenever a
> window of change arises gradually breaking into smaller modules will help.
>
> On Mon, Nov 22, 2010 at 7:31 PM, Ron Wheeler<rwheeler@artifact-software.com
>> wrote:
>> If you can not reorganize your project, you should probably stick with Ant.
>> Maven is a great tool but you have to use it in the way it was designed to
>> be use.
>> It relies a lot on the fact that your projects follow a set of conventions
>> and if they do not, you will spend a lot of time fighting with Maven without
>> getting very much benefit.
>>
>> Maven simplifies your life but only if you are able and willing to change
>> your development processes.
>>
>> There is nothing wrong with Ant and if you can not adapt to Maven, stick
>> with Ant.
>>
>> We have a project that is similar in size to yours. It is a portal so it
>> has about 50 WAR files that implement Web Services and Servlets.
>> It includes another 20 projects that produce JAR files.
>>
>> We build it 100% with Maven and use no custom Maven plug-ins.
>> We try to be as close to out-of-the-box with Maven as possible and have
>> structured the project to fit Maven.
>>
>> This strategy has resulted in a project that:
>> is very stable, releases and new functionality only affects a small number
>> of projects
>> produces a robust application
>> is easy to maintain,
>> has very small POM files
>> has very few dependencies (5-8) in most of the POMs while we use over 50
>> third party libraries - Spring, Hibernate, JasperReports, CXF, Apache
>> Commons, MySQL, and more.
>>
>> Ron
>>
>>
>> On 22/11/2010 7:56 AM, Ron Wheeler wrote:
>>
>>> A single project with 1500 files should be restructured into about 50
>>> functionally independent projects that can be built, tested and deployed
>>> individually.
>>> All but one will produce JAR files.
>>> Use aggregation projects to group the small JARs into larger JARs that can
>>> be deployed and used as dependencies to simplify other POM files.
>>>
>>> This will also help in a number of ways:
>>> Increased stability of your code base
>>> Start down the road to SOA.
>>> Improve the team's ability to divide up the work and not get under each
>>> other's feet.
>>> Dramatically reduce build times by reducing the time wasted rebuilding
>>> stuff that has not changed.
>>> Reduce SCM download traffic
>>> etc.
>>>
>>> Ron
>>>
>>>
>>>
>>> On 22/11/2010 5:54 AM, Jörg Schaible wrote:
>>>
>>>> Hi,
>>>>
>>>> Kamran Yadav wrote:
>>>>
>>>>   I am using 2.3.2 now but no improvement.
>>>>> I understand I can create a separate project for the classes only but
>>>>> that
>>>>> is not in my control.
>>>>>
>>>>> Anyway is there anyway to produce the compiled class outside of
>>>>> target/classes folder as in say C:\etc.etc.
>>>>>
>>>> Well, please reconsider your usage of Maven. While I am quite sure, that
>>>> a
>>>> way can be found to do this, you contradict the usage of Maven. This is
>>>> not
>>>> Ant. An essential part of Maven are conventions. If you decide not to
>>>> follow
>>>> them, you implicitly also call Maven into question. Therefore you will
>>>> often
>>>> get the answer "follow the Maven way". If you fight it, you will not win
>>>> a
>>>> lot.
>>>>
>>>> - Jörg
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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: maven to build thin war

Posted by Kamran Yadav <ka...@gmail.com>.
Thanks everybody

The project is legacy so cannot be changed easily. But surely whenever a
window of change arises gradually breaking into smaller modules will help.

On Mon, Nov 22, 2010 at 7:31 PM, Ron Wheeler <rwheeler@artifact-software.com
> wrote:

> If you can not reorganize your project, you should probably stick with Ant.
> Maven is a great tool but you have to use it in the way it was designed to
> be use.
> It relies a lot on the fact that your projects follow a set of conventions
> and if they do not, you will spend a lot of time fighting with Maven without
> getting very much benefit.
>
> Maven simplifies your life but only if you are able and willing to change
> your development processes.
>
> There is nothing wrong with Ant and if you can not adapt to Maven, stick
> with Ant.
>
> We have a project that is similar in size to yours. It is a portal so it
> has about 50 WAR files that implement Web Services and Servlets.
> It includes another 20 projects that produce JAR files.
>
> We build it 100% with Maven and use no custom Maven plug-ins.
> We try to be as close to out-of-the-box with Maven as possible and have
> structured the project to fit Maven.
>
> This strategy has resulted in a project that:
> is very stable, releases and new functionality only affects a small number
> of projects
> produces a robust application
> is easy to maintain,
> has very small POM files
> has very few dependencies (5-8) in most of the POMs while we use over 50
> third party libraries - Spring, Hibernate, JasperReports, CXF, Apache
> Commons, MySQL, and more.
>
> Ron
>
>
> On 22/11/2010 7:56 AM, Ron Wheeler wrote:
>
>> A single project with 1500 files should be restructured into about 50
>> functionally independent projects that can be built, tested and deployed
>> individually.
>> All but one will produce JAR files.
>> Use aggregation projects to group the small JARs into larger JARs that can
>> be deployed and used as dependencies to simplify other POM files.
>>
>> This will also help in a number of ways:
>> Increased stability of your code base
>> Start down the road to SOA.
>> Improve the team's ability to divide up the work and not get under each
>> other's feet.
>> Dramatically reduce build times by reducing the time wasted rebuilding
>> stuff that has not changed.
>> Reduce SCM download traffic
>> etc.
>>
>> Ron
>>
>>
>>
>> On 22/11/2010 5:54 AM, Jörg Schaible wrote:
>>
>>> Hi,
>>>
>>> Kamran Yadav wrote:
>>>
>>>  I am using 2.3.2 now but no improvement.
>>>>
>>>> I understand I can create a separate project for the classes only but
>>>> that
>>>> is not in my control.
>>>>
>>>> Anyway is there anyway to produce the compiled class outside of
>>>> target/classes folder as in say C:\etc.etc.
>>>>
>>> Well, please reconsider your usage of Maven. While I am quite sure, that
>>> a
>>> way can be found to do this, you contradict the usage of Maven. This is
>>> not
>>> Ant. An essential part of Maven are conventions. If you decide not to
>>> follow
>>> them, you implicitly also call Maven into question. Therefore you will
>>> often
>>> get the answer "follow the Maven way". If you fight it, you will not win
>>> a
>>> lot.
>>>
>>> - Jörg
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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: maven to build thin war

Posted by Ron Wheeler <rw...@artifact-software.com>.
If you can not reorganize your project, you should probably stick with Ant.
Maven is a great tool but you have to use it in the way it was designed 
to be use.
It relies a lot on the fact that your projects follow a set of 
conventions and if they do not, you will spend a lot of time fighting 
with Maven without getting very much benefit.

Maven simplifies your life but only if you are able and willing to 
change your development processes.

There is nothing wrong with Ant and if you can not adapt to Maven, stick 
with Ant.

We have a project that is similar in size to yours. It is a portal so it 
has about 50 WAR files that implement Web Services and Servlets.
It includes another 20 projects that produce JAR files.

We build it 100% with Maven and use no custom Maven plug-ins.
We try to be as close to out-of-the-box with Maven as possible and have 
structured the project to fit Maven.

This strategy has resulted in a project that:
is very stable, releases and new functionality only affects a small 
number of projects
produces a robust application
is easy to maintain,
has very small POM files
has very few dependencies (5-8) in most of the POMs while we use over 50 
third party libraries - Spring, Hibernate, JasperReports, CXF, Apache 
Commons, MySQL, and more.

Ron

On 22/11/2010 7:56 AM, Ron Wheeler wrote:
> A single project with 1500 files should be restructured into about 50 
> functionally independent projects that can be built, tested and 
> deployed individually.
> All but one will produce JAR files.
> Use aggregation projects to group the small JARs into larger JARs that 
> can be deployed and used as dependencies to simplify other POM files.
>
> This will also help in a number of ways:
> Increased stability of your code base
> Start down the road to SOA.
> Improve the team's ability to divide up the work and not get under 
> each other's feet.
> Dramatically reduce build times by reducing the time wasted rebuilding 
> stuff that has not changed.
> Reduce SCM download traffic
> etc.
>
> Ron
>
>
>
> On 22/11/2010 5:54 AM, Jörg Schaible wrote:
>> Hi,
>>
>> Kamran Yadav wrote:
>>
>>> I am using 2.3.2 now but no improvement.
>>>
>>> I understand I can create a separate project for the classes only 
>>> but that
>>> is not in my control.
>>>
>>> Anyway is there anyway to produce the compiled class outside of
>>> target/classes folder as in say C:\etc.etc.
>> Well, please reconsider your usage of Maven. While I am quite sure, 
>> that a
>> way can be found to do this, you contradict the usage of Maven. This 
>> is not
>> Ant. An essential part of Maven are conventions. If you decide not to 
>> follow
>> them, you implicitly also call Maven into question. Therefore you 
>> will often
>> get the answer "follow the Maven way". If you fight it, you will not 
>> win a
>> lot.
>>
>> - Jörg
>>
>>
>> ---------------------------------------------------------------------
>> 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: maven to build thin war

Posted by Ron Wheeler <rw...@artifact-software.com>.
A single project with 1500 files should be restructured into about 50 
functionally independent projects that can be built, tested and deployed 
individually.
All but one will produce JAR files.
Use aggregation projects to group the small JARs into larger JARs that 
can be deployed and used as dependencies to simplify other POM files.

This will also help in a number of ways:
Increased stability of your code base
Start down the road to SOA.
Improve the team's ability to divide up the work and not get under each 
other's feet.
Dramatically reduce build times by reducing the time wasted rebuilding 
stuff that has not changed.
Reduce SCM download traffic
etc.

Ron



On 22/11/2010 5:54 AM, Jörg Schaible wrote:
> Hi,
>
> Kamran Yadav wrote:
>
>> I am using 2.3.2 now but no improvement.
>>
>> I understand I can create a separate project for the classes only but that
>> is not in my control.
>>
>> Anyway is there anyway to produce the compiled class outside of
>> target/classes folder as in say C:\etc.etc.
> Well, please reconsider your usage of Maven. While I am quite sure, that a
> way can be found to do this, you contradict the usage of Maven. This is not
> Ant. An essential part of Maven are conventions. If you decide not to follow
> them, you implicitly also call Maven into question. Therefore you will often
> get the answer "follow the Maven way". If you fight it, you will not win a
> lot.
>
> - Jörg
>
>
> ---------------------------------------------------------------------
> 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: maven to build thin war

Posted by Jörg Schaible <jo...@scalaris.com>.
Hi,

Kamran Yadav wrote:

> I am using 2.3.2 now but no improvement.
> 
> I understand I can create a separate project for the classes only but that
> is not in my control.
> 
> Anyway is there anyway to produce the compiled class outside of
> target/classes folder as in say C:\etc.etc.

Well, please reconsider your usage of Maven. While I am quite sure, that a 
way can be found to do this, you contradict the usage of Maven. This is not 
Ant. An essential part of Maven are conventions. If you decide not to follow 
them, you implicitly also call Maven into question. Therefore you will often 
get the answer "follow the Maven way". If you fight it, you will not win a 
lot.

- Jörg


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


Re: maven to build thin war

Posted by Kamran Yadav <ka...@gmail.com>.
I am using 2.3.2 now but no improvement.

I understand I can create a separate project for the classes only but that
is not in my control.

Anyway is there anyway to produce the compiled class outside of
target/classes folder as in say C:\etc.etc.

On Mon, Nov 22, 2010 at 2:07 PM, Antonio Petrelli <
antonio.petrelli@gmail.com> wrote:

> 2010/11/22 Kamran Yadav <ka...@gmail.com>:
> >                                       <plugin>
> > <artifactId>maven-compiler-plugin</artifactId>
> > <version>2.0</version>
>
> It seems a bit outdated, the latest version is 2.3.2.
>
> >   - The war file includes all the classes also but I don't want. I
> >   tried <archiveClasses>true</archiveClasses> also but then it includes
> the
> >   generated jar. I don't want that either.
>
> I'm confused, why did you put those source file in the war project? Do
> you mean that those classes are put inside the server?
> If this is the case, the best you can do is creating another project
> to put those classes and add a dependency with scope "provided" to the
> war project.
>
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: maven to build thin war

Posted by Antonio Petrelli <an...@gmail.com>.
2010/11/22 Kamran Yadav <ka...@gmail.com>:
>                                       <plugin>
> <artifactId>maven-compiler-plugin</artifactId>
> <version>2.0</version>

It seems a bit outdated, the latest version is 2.3.2.

>   - The war file includes all the classes also but I don't want. I
>   tried <archiveClasses>true</archiveClasses> also but then it includes the
>   generated jar. I don't want that either.

I'm confused, why did you put those source file in the war project? Do
you mean that those classes are put inside the server?
If this is the case, the best you can do is creating another project
to put those classes and add a dependency with scope "provided" to the
war project.

Antonio

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