Re: migrating from Eclipse to a Maven build

2012-06-07 Thread Benson Margulies
I think the bottom line here is that there are nuances to 'don't fight maven.'

Rearranging the tree within the reach of the various POM elements is
not a big deal. The big pain comes when you try to fight with the
workflow and artifact architecture.

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



Re: migrating from Eclipse to a Maven build

2012-06-07 Thread Ron Wheeler

I am not religious in either direction.
My comment was more of an invitation to try to see the difference 
between what Ron has and what Eclipse and M2 would setup, given their 
own devices.

From that, Ron could make a decision.

At Artifact, we try to follow Maven conventions as closely as possible.

Ron

On 07/06/2012 11:43 AM, Curtis Rueden wrote:

Hi RonA, Antonio&  everyone,

On Thu, Jun 7, 2012 at 9:15 AM, Antonio Petrelli wrote:


However I disagree with Ron, once you move to Maven, you'd better move
in a clean way, so it's better to move directory as the Maven standard
layout suggests.


Why? Maven does not require it. You can keep your existing source folder
(say, "src") using a single line of XML in the  section:

 ${project.basedir}/src

If you have unit tests in a "test" folder you can do that too:

 ${project.basedir}/test

Even if you want to keep your resources mixed in with your source (which a
lot of people do, even though IMO it is less clean), you can do that as
well; e.g.:

 
   
 ${project.basedir}/src
 
   **/*.java
 
   
 
 
   
 ${project.basedir}/test
 
   **/*.java
 
   
 

> From my perspective, one of the most common excuses for disliking Maven is
the "overly nested src/main/java" directory structure, but people often do
not realize that it is merely a convention, not a requirement. There are
many other Maven conventions that IMO have much more serious consequences
if not followed. Violating the standard directory structure is really not a
serious offender in comparison, and it can greatly aid in migrating a
project to Maven in a less disruptive way.

Regards,
Curtis

P.S. The Eclipse plugin you need is called M2E, and it comes with the
Eclipse 3.7 for Java Developers distribution (not just with Eclipse STS).
However, if you must use a specific other flavor of Eclipse, it can likely
still be installed just fine using the M2E update site (linked from
http://www.eclipse.org/m2e/download/).

Another alternative is the maven-eclipse-plugin (i.e., "mvn
eclipse:eclipse" to manually generate Eclipse metadata files), but IMO it
is less convenient. With M2E, your dependencies will automagically switch
between JAR dependencies (out of ~/.m2/repository) and Eclipse project
dependencies as you open and close upstream projects within Eclipse.


On Thu, Jun 7, 2012 at 9:15 AM, Antonio Petrelli
wrote:
2012/6/7 Ronald Albury:

I have the project layout pretty clean - with one artifact per project

(jar

library, executable jar, war/ear).  There are three top level

applications

that come out of the workspace - an ear and two runnable jar files.  The
jar libraries are shared across the three applications.  I have heard
rumors that Maven will object to this sort of layout ... I'd be

interested

in your opinion on that subject.

Don't care about those rumours, they must be Ant users :-D
Seriously, the fact that you have alread one artifact per project it's
a nice start. All you have to do is create a project of time "pom" to
rule them all, and then a module for each artifact. The type of the
modules must match the type of your project (jar, ear, war).
Dependencies between modules are just like the other dependencies.
However I disagree with Ron, once you move to Maven, you'd better move
in a clean way, so it's better to move directory as the Maven standard
layout suggests.

Antonio

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





--
Ron Wheeler President Artifact Software Inc email: 
rwhee...@artifact-software.com skype: ronaldmwheeler phone: 
866-970-2435, ext 102


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



Re: migrating from Eclipse to a Maven build

2012-06-07 Thread Curtis Rueden
Hi RonA, Antonio & everyone,

On Thu, Jun 7, 2012 at 9:15 AM, Antonio Petrelli wrote:

> However I disagree with Ron, once you move to Maven, you'd better move
> in a clean way, so it's better to move directory as the Maven standard
> layout suggests.


Why? Maven does not require it. You can keep your existing source folder
(say, "src") using a single line of XML in the  section:

${project.basedir}/src

If you have unit tests in a "test" folder you can do that too:

${project.basedir}/test

Even if you want to keep your resources mixed in with your source (which a
lot of people do, even though IMO it is less clean), you can do that as
well; e.g.:


  
${project.basedir}/src

  **/*.java

  


  
${project.basedir}/test

  **/*.java

  


>From my perspective, one of the most common excuses for disliking Maven is
the "overly nested src/main/java" directory structure, but people often do
not realize that it is merely a convention, not a requirement. There are
many other Maven conventions that IMO have much more serious consequences
if not followed. Violating the standard directory structure is really not a
serious offender in comparison, and it can greatly aid in migrating a
project to Maven in a less disruptive way.

Regards,
Curtis

P.S. The Eclipse plugin you need is called M2E, and it comes with the
Eclipse 3.7 for Java Developers distribution (not just with Eclipse STS).
However, if you must use a specific other flavor of Eclipse, it can likely
still be installed just fine using the M2E update site (linked from
http://www.eclipse.org/m2e/download/).

Another alternative is the maven-eclipse-plugin (i.e., "mvn
eclipse:eclipse" to manually generate Eclipse metadata files), but IMO it
is less convenient. With M2E, your dependencies will automagically switch
between JAR dependencies (out of ~/.m2/repository) and Eclipse project
dependencies as you open and close upstream projects within Eclipse.


On Thu, Jun 7, 2012 at 9:15 AM, Antonio Petrelli  wrote:

> 2012/6/7 Ronald Albury :
> > I have the project layout pretty clean - with one artifact per project
> (jar
> > library, executable jar, war/ear).  There are three top level
> applications
> > that come out of the workspace - an ear and two runnable jar files.  The
> > jar libraries are shared across the three applications.  I have heard
> > rumors that Maven will object to this sort of layout ... I'd be
> interested
> > in your opinion on that subject.
>
> Don't care about those rumours, they must be Ant users :-D
> Seriously, the fact that you have alread one artifact per project it's
> a nice start. All you have to do is create a project of time "pom" to
> rule them all, and then a module for each artifact. The type of the
> modules must match the type of your project (jar, ear, war).
> Dependencies between modules are just like the other dependencies.
> However I disagree with Ron, once you move to Maven, you'd better move
> in a clean way, so it's better to move directory as the Maven standard
> layout suggests.
>
> Antonio
>
> -
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>


Re: migrating from Eclipse to a Maven build

2012-06-07 Thread Antonio Petrelli
2012/6/7 Ronald Albury :
> I have the project layout pretty clean - with one artifact per project (jar
> library, executable jar, war/ear).  There are three top level applications
> that come out of the workspace - an ear and two runnable jar files.  The
> jar libraries are shared across the three applications.  I have heard
> rumors that Maven will object to this sort of layout ... I'd be interested
> in your opinion on that subject.

Don't care about those rumours, they must be Ant users :-D
Seriously, the fact that you have alread one artifact per project it's
a nice start. All you have to do is create a project of time "pom" to
rule them all, and then a module for each artifact. The type of the
modules must match the type of your project (jar, ear, war).
Dependencies between modules are just like the other dependencies.
However I disagree with Ron, once you move to Maven, you'd better move
in a clean way, so it's better to move directory as the Maven standard
layout suggests.

Antonio

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



Re: migrating from Eclipse to a Maven build

2012-06-07 Thread Ronald Albury
Thanks Ron

The other fly in the ointment is that this is an IBM shop and we are
required to develop in IBM's RAD flavor of Eclipse.  That doesn't mean we
can't add plugins - only that we can't go to STS.

I have the project layout pretty clean - with one artifact per project (jar
library, executable jar, war/ear).  There are three top level applications
that come out of the workspace - an ear and two runnable jar files.  The
jar libraries are shared across the three applications.  I have heard
rumors that Maven will object to this sort of layout ... I'd be interested
in your opinion on that subject.

Thanks again for your input.  I'll give your M2 plugin suggestions a try.

RonA

On Thu, Jun 7, 2012 at 9:29 AM, Ron Wheeler
wrote:

> On 07/06/2012 8:59 AM, Ronald Albury wrote:
>
>> I have seen much documentation of importing a Maven project into Eclipse.
>>  However, many of us have the opposite situation - we are starting with an
>> Eclipse set-up and have decided to migrate to Maven for the builds.
>>
>> I did find one posting on the subject - the author, like myself, was
>> intimidated by Maven ... and especially intimidated by the differences in
>> the directory layout between Maven and Eclipse.  However, he said that
>> since he was well experienced in Eclipse he was able to muddle thru it.
>>  Muddle thru it how?  The only thing I can think of is to start by
>> building
>> a Maven set-up, manually moving my Eclipse files into the Maven projects,
>> and then importing back into Eclipse.
>>
>> Surely there is a better way than that!
>>
>> Thanks for your patience and your assistance,
>>RonA
>>
>>  The directory structure is not any different except where the root is in
> your source tree unless you have done some strange things with your sources
> or other resources.
> Have Eclipse, with M2, (or Eclipse STS) generate a Maven project for you,
> add a simple dummy program and compile it. Then compare your source layout
> with Eclipse's maven layout and see how much your current layout differs.
>
> Ron
>
> --
> Ron Wheeler President Artifact Software Inc email:
> rwhee...@artifact-software.com skype: ronaldmwheeler phone: 866-970-2435,
> ext 102
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@maven.**apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>


Re: migrating from Eclipse to a Maven build

2012-06-07 Thread Ron Wheeler

On 07/06/2012 8:59 AM, Ronald Albury wrote:

I have seen much documentation of importing a Maven project into Eclipse.
  However, many of us have the opposite situation - we are starting with an
Eclipse set-up and have decided to migrate to Maven for the builds.

I did find one posting on the subject - the author, like myself, was
intimidated by Maven ... and especially intimidated by the differences in
the directory layout between Maven and Eclipse.  However, he said that
since he was well experienced in Eclipse he was able to muddle thru it.
  Muddle thru it how?  The only thing I can think of is to start by building
a Maven set-up, manually moving my Eclipse files into the Maven projects,
and then importing back into Eclipse.

Surely there is a better way than that!

Thanks for your patience and your assistance,
RonA

The directory structure is not any different except where the root is in 
your source tree unless you have done some strange things with your 
sources or other resources.
Have Eclipse, with M2, (or Eclipse STS) generate a Maven project for 
you, add a simple dummy program and compile it. Then compare your source 
layout with Eclipse's maven layout and see how much your current layout 
differs.


Ron

--
Ron Wheeler President Artifact Software Inc email: 
rwhee...@artifact-software.com skype: ronaldmwheeler phone: 
866-970-2435, ext 102


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



Re: migrating from Eclipse to a Maven build

2012-06-07 Thread Ron Wheeler

My 2 cents.
Move from Eclipse to Eclipse STS from Springsource.
This gives you an Eclipse ready to go out-of-the-box with Maven and 
everything else you need to develop in Java.


I believe that you can then add the maven nature to your project.

Adjust the Maven POM, if required, to point to your source directory as 
it is. Maven is pretty flexible about many things.


Add the dependencies that you need to the POM.

At that point, you should be able to build in Eclipse with Maven. Just 
point at the POM=> right click => Run As and select the Maven goal that 
you want to run.


Not a big deal.

For new projects, just tell STS that you want a maven project and it 
will build you one that works once you add your dependencies.


If you don't want to go to STS you can manually add m2 plug-in and 
whatever else you need.
We started that way (plain Eclipse) but just lost so much time screwing 
around with Eclipse plug-ins on every new Eclipse release that we moved 
to STS. One donwload and a quick install and your new version of Eclipse 
is ready to go.


We never use Maven outside Eclipse but others do.

Ron


On 07/06/2012 8:59 AM, Ronald Albury wrote:

I have seen much documentation of importing a Maven project into Eclipse.
  However, many of us have the opposite situation - we are starting with an
Eclipse set-up and have decided to migrate to Maven for the builds.

I did find one posting on the subject - the author, like myself, was
intimidated by Maven ... and especially intimidated by the differences in
the directory layout between Maven and Eclipse.  However, he said that
since he was well experienced in Eclipse he was able to muddle thru it.
  Muddle thru it how?  The only thing I can think of is to start by building
a Maven set-up, manually moving my Eclipse files into the Maven projects,
and then importing back into Eclipse.

Surely there is a better way than that!

Thanks for your patience and your assistance,
RonA




--
Ron Wheeler President Artifact Software Inc email: 
rwhee...@artifact-software.com skype: ronaldmwheeler phone: 
866-970-2435, ext 102


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



migrating from Eclipse to a Maven build

2012-06-07 Thread Ronald Albury
I have seen much documentation of importing a Maven project into Eclipse.
 However, many of us have the opposite situation - we are starting with an
Eclipse set-up and have decided to migrate to Maven for the builds.

I did find one posting on the subject - the author, like myself, was
intimidated by Maven ... and especially intimidated by the differences in
the directory layout between Maven and Eclipse.  However, he said that
since he was well experienced in Eclipse he was able to muddle thru it.
 Muddle thru it how?  The only thing I can think of is to start by building
a Maven set-up, manually moving my Eclipse files into the Maven projects,
and then importing back into Eclipse.

Surely there is a better way than that!

Thanks for your patience and your assistance,
   RonA