You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Bertrand Delacretaz <bd...@apache.org> on 2009/04/20 10:07:00 UTC

Re: What are the best practices developing bundles for Sling in Eclipse?

Hi Mike,

On Mon, Apr 20, 2009 at 9:45 AM, Mike Müller <mi...@mysign.ch> wrote:
> ...So what are the best pracices to develop an OSGi bundle for Sling in Eclipse?
> How are you guys developing/testing bigger projects for Sling?
> (including packaging the jar with the correct manifest)....

The way I do it might not be a best practice but that works for me:

-Start by copying and adapting an existing Sling pom that looks like what I need
-Generate the Eclipse project files using mvn eclipse:eclipse
-Disable the Java builder in the Eclipse projects
-Build and test from the command-line, using the Eclipse remote debugger
-If adding dependencies to my poms, run mvn eclipse:eclipse again and
refresh the project in Eclipse
-Use the subclipse svn client for most things, back to the command
line for the really important stuff

I know some people want things more integrated with their IDE, but as
I said the above works fine for me, and I'm almost never fighting with
the IDE.

-Bertrand

Re: What are the best practices developing bundles for Sling in Eclipse?

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Mike,

On Mon, Apr 20, 2009 at 9:31 PM, Mike Müller <mi...@mysign.ch> wrote:
> ...I tried your setup and it doesn't feel (as it seems on a first view) that
> unproductive....

Sure, it kind of works ;-)

> ...You haven't to turn off the Java Builder needfully. Let it turned
> on, you get all the compiling warnings and errors as usual....

I *think* I started turning that off because I was losing track of
what was compiling what in my target folder. But I might try turning
on again, you're right.

-Bertrand

AW: What are the best practices developing bundles for Sling in Eclipse?

Posted by Mike Müller <mi...@mysign.ch>.
Hi Bertrand

> I learned programming back when waiting for a compilation meant going
> out for a coffee (or lunch if you still had floppy disks ;-), and
> still appreciate some effort before compiling, to try and be a bit
> careful...YMMV of course.

I come from this ancient long past time as well :-))
And yes, I certainly agree, it's worth to have a deep look at the
code before compiling - even if compiling is much more faster today.

> If I find an easy way to have hyperlinks from compilation errors, I
> will probably activate it, but right now I prefer not having to worry
> too much about my IDE. You could say that I use Eclipse as an editor /
> code browser / pre-compilation analyzer / coding assistance tool /
> debugger, that's a lot already, it just not include the build cycle.

I tried your setup and it doesn't feel (as it seems on a first view) that
unproductive. You haven't to turn off the Java Builder needfully. Let it turned
on, you get all the compiling warnings and errors as usual.

best regards
mike

Re: What are the best practices developing bundles for Sling in Eclipse?

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Mike,

On Mon, Apr 20, 2009 at 1:38 PM, Mike Müller <mi...@mysign.ch> wrote:
> ...If I get you right, that means, that you do not compile in Eclipse.
> So you do not get errros and warnings in Eclipse. Does that mean
> you use Eclipse only as editor, or do I get things wrong?...

Correct, I compile with maven at the command-line, so I do not get
hyperlinks from compiling errors to the corresponding java code.

But you still get all the pre-compilation warnings in Eclipse,
combined with coding assistance (method parameters etc), so I don't
get that many compiling errors. And requiring a round-trip of a few
seconds to compile and get the results means that I'm a bit more
careful when writing code, which (for me) tends to lead to better
code.

I learned programming back when waiting for a compilation meant going
out for a coffee (or lunch if you still had floppy disks ;-), and
still appreciate some effort before compiling, to try and be a bit
careful...YMMV of course.

If I find an easy way to have hyperlinks from compilation errors, I
will probably activate it, but right now I prefer not having to worry
too much about my IDE. You could say that I use Eclipse as an editor /
code browser / pre-compilation analyzer / coding assistance tool /
debugger, that's a lot already, it just not include the build cycle.

> ...I do hesitate to use maven as central build tool, but would like
> to see errors and warnings in Eclipse, and Eclipse should also
> know the definitions for easy jumping in the code....

Definitions are no problem, but you sometimes need to refresh the
Eclipse view of them, if you changed things in another bundle. Errors
and warning, as I said, don't work in Eclipse with my current setup.

On the other hand, having fully reproducible builds, saved in
subversion (as poms) and 100% independent of the programmer's IDE
settings, is a requirement for me, much more important than a more
integrated build cycle.

> ...Have you Bertrand - or someone else - tried another setup where
> at least compiling to classes is done in Eclipse?...

I'm sure someone has tried...it'll be interesting to find out if they
have succeeded ;-)

-Bertrand

Re: AW: What are the best practices developing bundles for Sling in Eclipse?

Posted by Michael Dürig <mi...@day.com>.
Mike,

I use basically the same setup like Bertrand. However, I don't disable 
the Java builder. This way I can directly jump to errors and warnings by 
point and click. The only problem I noticed with this setup recently is 
that the OSGi foundation bundle sometimes gets into the way. I fixed 
this by putting it to the very end of the Eclipse build class path.

Michael


Mike Müller wrote:
> Hi Bertrand
> 
> If I get you right, that means, that you do not compile in Eclipse.
> So you do not get errros and warnings in Eclipse. Does that mean
> you use Eclipse only as editor, or do I get things wrong?
> (I must admit, that I do not have deep knowledge of maven...)
> I do hesitate to use maven as central build tool, but would like
> to see errors and warnings in Eclipse, and Eclipse should also
> know the definitions for easy jumping in the code.
> Have you Bertrand - or someone else - tried another setup where
> at least compiling to classes is done in Eclipse?
> 
> best regards
> mike
> 
> 
>>> ...So what are the best pracices to develop an OSGi bundle
>> for Sling in Eclipse?
>>> How are you guys developing/testing bigger projects for Sling?
>>> (including packaging the jar with the correct manifest)....
>> The way I do it might not be a best practice but that works for me:
>>
>> -Start by copying and adapting an existing Sling pom that
>> looks like what I need
>> -Generate the Eclipse project files using mvn eclipse:eclipse
>> -Disable the Java builder in the Eclipse projects
>> -Build and test from the command-line, using the Eclipse
>> remote debugger
>> -If adding dependencies to my poms, run mvn eclipse:eclipse again and
>> refresh the project in Eclipse
>> -Use the subclipse svn client for most things, back to the command
>> line for the really important stuff
>>
>> I know some people want things more integrated with their IDE, but as
>> I said the above works fine for me, and I'm almost never fighting with
>> the IDE.


AW: What are the best practices developing bundles for Sling in Eclipse?

Posted by Mike Müller <mi...@mysign.ch>.
Hi Bertrand

If I get you right, that means, that you do not compile in Eclipse.
So you do not get errros and warnings in Eclipse. Does that mean
you use Eclipse only as editor, or do I get things wrong?
(I must admit, that I do not have deep knowledge of maven...)
I do hesitate to use maven as central build tool, but would like
to see errors and warnings in Eclipse, and Eclipse should also
know the definitions for easy jumping in the code.
Have you Bertrand - or someone else - tried another setup where
at least compiling to classes is done in Eclipse?

best regards
mike


> > ...So what are the best pracices to develop an OSGi bundle
> for Sling in Eclipse?
> > How are you guys developing/testing bigger projects for Sling?
> > (including packaging the jar with the correct manifest)....
>
> The way I do it might not be a best practice but that works for me:
>
> -Start by copying and adapting an existing Sling pom that
> looks like what I need
> -Generate the Eclipse project files using mvn eclipse:eclipse
> -Disable the Java builder in the Eclipse projects
> -Build and test from the command-line, using the Eclipse
> remote debugger
> -If adding dependencies to my poms, run mvn eclipse:eclipse again and
> refresh the project in Eclipse
> -Use the subclipse svn client for most things, back to the command
> line for the really important stuff
>
> I know some people want things more integrated with their IDE, but as
> I said the above works fine for me, and I'm almost never fighting with
> the IDE.