You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Mike Müller <mi...@mysign.ch> on 2009/04/13 14:58:44 UTC

Problems to build in eclipse

Hi

I've got some problems to build sling in eclipse. Have tried no for hours to get rid off the error, but haven't succeeded, maybe just a little thing which I can't see, hope someone can help:

my environment:
windows xp sp 3
eclipse 3.4 with maven2-plugin (sonatype, newest) and subversive
installed maven 2.1.0
jre 1.5 und jdk 1.6

What I've done so far:

1) getting the sling source from svn (with eclipse subversive) which creates a java project with no builders called sling in the workspace
2) building the source with maven -> no problem
3) calling mvn eclipse:eclipse
4) import projects in eclipse with File/Import, choosing "Existing projects into Workspace", selecting the folder <workspace>/sling/bundles (because eclipse can't find the projects in the subfolders if I select only <workspace>/sling. choosing all projects.
5) eclipse tries to build the projects but gets a lot of following errors: xy cannot be resolved (Java Problem), first error is AdapterType cannot be resolved in ScriptableResourceTest.java, line 215.

It seems that eclipse tries to build with Java 1.4 (can't recognize generics...). But eclipse points to jdk 6, and there's no problem in other projects. I tried java 1.5 as well, no luck.

what have I missed?

best regards
mike

Re: AW: Problems to build in eclipse

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Mike,

Mike Müller schrieb:
> Hi Bertrand, hi Pontus
> 
> Thanks very much for your suggestions. I tried the remote debugging way and it worked well.
> I'm wondering a little bit, that the best open source thing which is available today to explore a jcr is the mentioned JCR Explorer which feels very basic and isn't any more under development. Maybe that's one of the reasons why JCR isn't taking the world by storm... - but yes, it worked.
> When searching the sling mailing list I read a lot of entries proposing a tool to explore JCR. Are there any efforts at the time to build a better explorer or do someone know from such a project being developed outside the sling community?
> My feeling is, that a good explorer is something very important to get a broad community building complex apps with a JCR based framework like sling.

Agreed from the depth of my heart -- and having a good explorer in Sling
would be a good thing, though I think Sling should really to a Resource
Explorer (which not just renders the repository Items but also resources
from ResourceProviders such as the Bundle resource provider or the file
system resource provider.

If you want to have something quickly, you might consider looking at the
CRX Feature for Eclipse, which is available for free from
http://www.day.com/eclipse/ (not open-source, though).

Hope this helps.

Regards
Felix

> 
> best regards
> mike
> 
>> I use remote debugging, starting Sling from the command-line
>> with options like
>>
>> java -Xmx384M -Xdebug -Xnoagent -Djava.compiler=NONE
>> -Xrunjdwp:transport=dt_socket,address=30303,server=y,suspend=n
>> ...
>>
>> And connect from Eclipse using a remote debugging session. There might
>> be more integrated ways, but that works for me.
>>
>> To update Sling bundles, I use the  -P autoInstallBundle maven profile
>> defined in parent/pom.xml.
>>
>> Until we have a better solution, the JCR Explorer can help, I have
>> written a post on my blog [1] about how to connect it with Sling.


AW: Problems to build in eclipse

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

Thanks very much for your suggestions. I tried the remote debugging way and it worked well.
I'm wondering a little bit, that the best open source thing which is available today to explore a jcr is the mentioned JCR Explorer which feels very basic and isn't any more under development. Maybe that's one of the reasons why JCR isn't taking the world by storm... - but yes, it worked.
When searching the sling mailing list I read a lot of entries proposing a tool to explore JCR. Are there any efforts at the time to build a better explorer or do someone know from such a project being developed outside the sling community?
My feeling is, that a good explorer is something very important to get a broad community building complex apps with a JCR based framework like sling.

best regards
mike

> I use remote debugging, starting Sling from the command-line
> with options like
>
> java -Xmx384M -Xdebug -Xnoagent -Djava.compiler=NONE
> -Xrunjdwp:transport=dt_socket,address=30303,server=y,suspend=n
> ...
>
> And connect from Eclipse using a remote debugging session. There might
> be more integrated ways, but that works for me.
>
> To update Sling bundles, I use the  -P autoInstallBundle maven profile
> defined in parent/pom.xml.
>
> Until we have a better solution, the JCR Explorer can help, I have
> written a post on my blog [1] about how to connect it with Sling.

Re: Problems to build in eclipse

Posted by Pontus Amberg <po...@comhem.se>.
Forgot to mention that the type of application I picked in the Debug 
Configuration dialog at the beginning was a normal "Java Application". I 
also changed the "Project" field to "org.apache.sling.launchpad.webapp" 
by clicking on the "Browse..." button in the new Java Application debug 
configuration.

If "org.apache.sling.launchpad.webapp" isn't available when you press 
the "Browse..." button you might need to add add the "Java facet" to the 
org.apache.sling.launchpad.webapp projekt
1. Right click on the org.apache.sling.launchpad.webapp in the Project 
explorer
2. Choose "Properties" in the context menu
3. In the Properties dialog click on Project Facets and make sure Java 
is checked.
4. Click OK.

/Pontus


Pontus Amberg wrote:
> And if you don't want to do "remote" debugging and debug Slin in jetty 
> you might follow the
> steps on this page 
> http://mahertb.blogspot.com/2006/08/debugging-maven-web-application-with.html 
> .
>
> I think I had to change the Program arguments to "jetty:run" instead 
> of "jetty6:run" and in the classpath tab I added
> "[MAVEN_HOME]/boot/classworlds-1.1.jar" instead of 
> "[MAVEN_HOME]/core/boot/classworlds-1.1.jar". But after that
> I was able to start and debug Sling in Jetty.
>
> /Pontus
>
> Bertrand Delacretaz wrote:
>> On Tue, Apr 14, 2009 at 6:16 PM, Mike Müller <mi...@mysign.ch> wrote:
>>  
>>> ...What are the best practice by now:
>>> - to debug sling (and self made bundles) with eclipse?...
>>>     
>>
>> I use remote debugging, starting Sling from the command-line with 
>> options like
>>
>> java -Xmx384M -Xdebug -Xnoagent -Djava.compiler=NONE
>> -Xrunjdwp:transport=dt_socket,address=30303,server=y,suspend=n
>> ...
>>
>> And connect from Eclipse using a remote debugging session. There might
>> be more integrated ways, but that works for me.
>>
>> To update Sling bundles, I use the  -P autoInstallBundle maven profile
>> defined in parent/pom.xml.
>>
>>  
>>> ...- to explore/modify the jcr (webdav is not sufficent)...
>>>     
>>
>> Until we have a better solution, the JCR Explorer can help, I have
>> written a post on my blog [1] about how to connect it with Sling.
>>
>> -Bertrand
>>
>> [1] 
>> http://grep.codeconsult.ch/2009/01/06/using-the-jcr-explorer-with-sling/
>>
>>   
>
>


Re: Problems to build in eclipse

Posted by Pontus Amberg <po...@comhem.se>.
And if you don't want to do "remote" debugging and debug Slin in jetty 
you might follow the
steps on this page 
http://mahertb.blogspot.com/2006/08/debugging-maven-web-application-with.html 
.

I think I had to change the Program arguments to "jetty:run" instead of 
"jetty6:run" and in the classpath tab I added
"[MAVEN_HOME]/boot/classworlds-1.1.jar" instead of 
"[MAVEN_HOME]/core/boot/classworlds-1.1.jar". But after that
I was able to start and debug Sling in Jetty.

/Pontus

Bertrand Delacretaz wrote:
> On Tue, Apr 14, 2009 at 6:16 PM, Mike Müller <mi...@mysign.ch> wrote:
>   
>> ...What are the best practice by now:
>> - to debug sling (and self made bundles) with eclipse?...
>>     
>
> I use remote debugging, starting Sling from the command-line with options like
>
> java -Xmx384M -Xdebug -Xnoagent -Djava.compiler=NONE
> -Xrunjdwp:transport=dt_socket,address=30303,server=y,suspend=n
> ...
>
> And connect from Eclipse using a remote debugging session. There might
> be more integrated ways, but that works for me.
>
> To update Sling bundles, I use the  -P autoInstallBundle maven profile
> defined in parent/pom.xml.
>
>   
>> ...- to explore/modify the jcr (webdav is not sufficent)...
>>     
>
> Until we have a better solution, the JCR Explorer can help, I have
> written a post on my blog [1] about how to connect it with Sling.
>
> -Bertrand
>
> [1] http://grep.codeconsult.ch/2009/01/06/using-the-jcr-explorer-with-sling/
>
>   


Re: Problems to build in eclipse

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Tue, Apr 14, 2009 at 6:16 PM, Mike Müller <mi...@mysign.ch> wrote:
> ...What are the best practice by now:
> - to debug sling (and self made bundles) with eclipse?...

I use remote debugging, starting Sling from the command-line with options like

java -Xmx384M -Xdebug -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,address=30303,server=y,suspend=n
...

And connect from Eclipse using a remote debugging session. There might
be more integrated ways, but that works for me.

To update Sling bundles, I use the  -P autoInstallBundle maven profile
defined in parent/pom.xml.

> ...- to explore/modify the jcr (webdav is not sufficent)...

Until we have a better solution, the JCR Explorer can help, I have
written a post on my blog [1] about how to connect it with Sling.

-Bertrand

[1] http://grep.codeconsult.ch/2009/01/06/using-the-jcr-explorer-with-sling/

AW: Problems to build in eclipse

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

That helped a lot, thank you very much. I succeeded with your desciption with the subversive plugin as well, but had to install another additional plugin for the integration with the m2plugin. I try to update the wiki page "Setting up Eclipse IDE" with this in the next few days.

After having the code in eclipse there are some more questions to work productive with sling:
What are the best practice by now:
- to debug sling (and self made bundles) with eclipse?
- to explore/modify the jcr (webdav is not sufficent)

best regards
mike


> -----Ursprüngliche Nachricht-----
> Von: Pontus Amberg [mailto:pontus.amberg@comhem.se]
> Gesendet: Montag, 13. April 2009 22:29
> An: sling-dev@incubator.apache.org
> Betreff: Re: Problems to build in eclipse
>
>
> Hi Mike.
>
> I'm using the almost the same config as you but subclipse instead of
> subversive and the easiest way
> I've found to get and build Sling in Eclipse is to use the
> "import..."
> option the the File menu. I also turn
> of the automatic build in Eclipse and instead use a run
> configuration to
> build Sling.
>
> First create a new Workspace
> 1. Menu: File->Switch Workspace->Other...
> 2. Enter a path for the new workspace and click OK
>
> When Eclipse has restarted its time to adjust some configs
> 1. Turn off automatic build (Menu: Project->Build Automatically)
> 2. Menu: Window->Preferences
> 3. In the preferences dialog select Java->Compiler->Errors/Warnings
> 4. Expand the "Deprecated and restricted API" and change  "Forbidden
> references (access rules)" from "Error" to "Warning"
> 5. Click OK
>
> Now its time to fetch the Sling source
> 1. Menu: File->Import
> 2. In the Import wizard select Maven->"Check out Maven
> Projects from SCM"
> 3. Click next
> 4. In the "SCM URL" field pick "SVN" and enter the url
> "http://svn.apache.org/repos/asf/incubator/sling/trunk"
> 5. Click Finish
>
> Eclipse will now start to download the source and import the Maven
> projects. You might
> encounter some "Problem Occured" dialogs about "An internal error..."
> but just click OK
> on those and let Eclipse continue with the import.
>
> When I've used Import to fetch Sling something in
> sling-builder seem to
> get a bit messed up but that can
> simply be fixed with revert.
> 1. In the Project Explorer right click on the "sling-builder" project
> and select the Team->Revert... menu
> 2. A couple of changes (9 in my case) will be displayed
> 3. Click OK
>
> Now its time to create a new run config used to build Sling
> 1. Make sure you're in the Java perspective (Menu:
> Window->Open Perspective)
> 2. Menu: Run->Run Configurations...
> 3. In the Run Configurationa dialog right click on "Maven Build" and
> select "New"
> 4. Change Name to "Build Sling"
> 5. Click "Browse Workspace..." and select "sling-builder"
> 6. Enter "clean install" in Goals
> 7. Click on the JRE tab
> 8. Enter "-Xmx256m -XX:MaxPermSize=128m" in "VM arguments"
> 11. Click Apply
> 12. Click Run
>
> This should build Sling.
>
> /Pontus

Re: Problems to build in eclipse

Posted by Pontus Amberg <po...@comhem.se>.
Hi Mike.

I'm using the almost the same config as you but subclipse instead of 
subversive and the easiest way
I've found to get and build Sling in Eclipse is to use the "import..." 
option the the File menu. I also turn
of the automatic build in Eclipse and instead use a run configuration to 
build Sling.

First create a new Workspace
1. Menu: File->Switch Workspace->Other...
2. Enter a path for the new workspace and click OK

When Eclipse has restarted its time to adjust some configs
1. Turn off automatic build (Menu: Project->Build Automatically)
2. Menu: Window->Preferences
3. In the preferences dialog select Java->Compiler->Errors/Warnings
4. Expand the "Deprecated and restricted API" and change  "Forbidden 
references (access rules)" from "Error" to "Warning"
5. Click OK

Now its time to fetch the Sling source
1. Menu: File->Import
2. In the Import wizard select Maven->"Check out Maven Projects from SCM"
3. Click next
4. In the "SCM URL" field pick "SVN" and enter the url 
"http://svn.apache.org/repos/asf/incubator/sling/trunk"
5. Click Finish

Eclipse will now start to download the source and import the Maven 
projects. You might
encounter some "Problem Occured" dialogs about "An internal error..." 
but just click OK
on those and let Eclipse continue with the import.

When I've used Import to fetch Sling something in sling-builder seem to 
get a bit messed up but that can
simply be fixed with revert.
1. In the Project Explorer right click on the "sling-builder" project 
and select the Team->Revert... menu
2. A couple of changes (9 in my case) will be displayed
3. Click OK

Now its time to create a new run config used to build Sling
1. Make sure you're in the Java perspective (Menu: Window->Open Perspective)
2. Menu: Run->Run Configurations...
3. In the Run Configurationa dialog right click on "Maven Build" and 
select "New"
4. Change Name to "Build Sling"
5. Click "Browse Workspace..." and select "sling-builder"
6. Enter "clean install" in Goals
7. Click on the JRE tab
8. Enter "-Xmx256m -XX:MaxPermSize=128m" in "VM arguments"
11. Click Apply
12. Click Run

This should build Sling.

/Pontus

Mike Müller wrote:
> Hi
>
> I've got some problems to build sling in eclipse. Have tried no for hours to get rid off the error, but haven't succeeded, maybe just a little thing which I can't see, hope someone can help:
>
> my environment:
> windows xp sp 3
> eclipse 3.4 with maven2-plugin (sonatype, newest) and subversive
> installed maven 2.1.0
> jre 1.5 und jdk 1.6
>
> What I've done so far:
>
> 1) getting the sling source from svn (with eclipse subversive) which creates a java project with no builders called sling in the workspace
> 2) building the source with maven -> no problem
> 3) calling mvn eclipse:eclipse
> 4) import projects in eclipse with File/Import, choosing "Existing projects into Workspace", selecting the folder <workspace>/sling/bundles (because eclipse can't find the projects in the subfolders if I select only <workspace>/sling. choosing all projects.
> 5) eclipse tries to build the projects but gets a lot of following errors: xy cannot be resolved (Java Problem), first error is AdapterType cannot be resolved in ScriptableResourceTest.java, line 215.
>
> It seems that eclipse tries to build with Java 1.4 (can't recognize generics...). But eclipse points to jdk 6, and there's no problem in other projects. I tried java 1.5 as well, no luck.
>
> what have I missed?
>
> best regards
> mike
>
>