Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Project (preferably Maven) using JDT(Need to use JDT API in my program)
Project (preferably Maven) using JDT [message #671906] Thu, 19 May 2011 10:22 Go to next message
Samuel Cox is currently offline Samuel Cox
Messages: 5
Registered: May 2011
Junior Member
Hi,

I would like to use the JDT's AST stuff in a program I'm writing. My preferred programming environment is vim + Maven + sbt. I do use Eclipse for debugging and refactoring;)

So, does anyone know of the best approach to adding the JDT as a dependency to a Maven project? Ideally, I'd just add the JDT dependency. If that is not an option, will someone give me some pointers on getting started (e.g. you should use the Eclipse IDE:)?

Many thanks.
Re: Project (preferably Maven) using JDT [message #671945 is a reply to message #671906] Thu, 19 May 2011 11:45 Go to previous messageGo to next message
Deepak Azad is currently offline Deepak Azad
Messages: 545
Registered: July 2009
Senior Member
On 5/19/2011 3:52 PM, forums-noreply@eclipse.org wrote:
> Hi,
>
> I would like to use the JDT's AST stuff in a program I'm writing. My
> preferred programming environment is vim + Maven + sbt. I do use Eclipse
> for debugging and refactoring;)
>
> So, does anyone know of the best approach to adding the JDT as a
> dependency to a Maven project? Ideally, I'd just add the JDT dependency.
> If that is not an option, will someone give me some pointers on getting
> started (e.g. you should use the Eclipse IDE:)?
>
> Many thanks.

- Do you want pointers on AST or other JDT API's? (This question can be
answered here)
- Or do you want to know how to build with Maven? (For this you should
go to Maven forum)
Re: Project (preferably Maven) using JDT [message #671955 is a reply to message #671945] Thu, 19 May 2011 12:58 Go to previous messageGo to next message
Samuel Cox is currently offline Samuel Cox
Messages: 5
Registered: May 2011
Junior Member
Deepak Azad wrote on Thu, 19 May 2011 07:45
On 5/19/2011 3:52 PM, forums-noreply@eclipse.org wrote:
> Hi,
>
> I would like to use the JDT's AST stuff in a program I'm writing. My
> preferred programming environment is vim + Maven + sbt. I do use Eclipse
> for debugging and refactoring;)
>
> So, does anyone know of the best approach to adding the JDT as a
> dependency to a Maven project? Ideally, I'd just add the JDT dependency.
> If that is not an option, will someone give me some pointers on getting
> started (e.g. you should use the Eclipse IDE:)?
>
> Many thanks.

- Do you want pointers on AST or other JDT API's? (This question can be
answered here)
- Or do you want to know how to build with Maven? (For this you should
go to Maven forum)


I need pointers on how to use AST and/or other JDT API's in a Java project. My preference is to use Maven, but I can use many other tools (e.g. Eclipse).

Pointers to documentation would be fine.

I don't need any help with normal Eclipse+Maven type questions.

Edit - I thought of another way to phrase this. I want to use JDT's AST class in my Java program. As such, I'll need all things required to use this class on my classpath. I'm trying to figure out how to get this list. Since I like Maven, I'd like to just add some-Maven-repo that has Eclipse JDT artifacts (i.e. jars) in it; however, I can adopt to other tools if I need to.

[Updated on: Thu, 19 May 2011 13:10]

Report message to a moderator

Re: Project (preferably Maven) using JDT [message #671996 is a reply to message #671955] Thu, 19 May 2011 14:31 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Once you figure out how (if) to consume JDT AST outside of eclipse (maybe JDT core doesn't need eclipse to run) then you can check out http://maven.eclipse.org/

It's still in the testing phase, but the plan is to host consumables from eclipse.org projects.

PW


Re: Project (preferably Maven) using JDT [message #671997 is a reply to message #671955] Thu, 19 May 2011 13:35 Go to previous messageGo to next message
Deepak Azad is currently offline Deepak Azad
Messages: 545
Registered: July 2009
Senior Member
On 5/19/2011 6:28 PM, forums-noreply@eclipse.org wrote:
> I need pointers on how to use AST and/or other JDT API's in a Java
> project.

All right, so you are at the right place :)

A nice article on AST :
http://www.eclipse.org/articles/article.php?file=Article-JavaCodeManipulation_AST/index.html

JDT Fundamentals tutorial:
http://www.eclipsecon.org/2010/sessions/?page=sessions&id=1339

Also look in Eclipse Help > JDT Plug-in developer guide.

These should get you started with JDT APIs, you can always come back
here for any specific questions.
Re: Project (preferably Maven) using JDT [message #672207 is a reply to message #671997] Fri, 20 May 2011 10:26 Go to previous messageGo to next message
Samuel Cox is currently offline Samuel Cox
Messages: 5
Registered: May 2011
Junior Member
Deepak Azad wrote on Thu, 19 May 2011 09:35
On 5/19/2011 6:28 PM, forums-noreply@eclipse.org wrote:
These should get you started with JDT APIs, you can always come back
here for any specific questions.


Is there a sample project and/or documentation that demonstrates using JDT in a normal (i.e. not Eclipse plugin) Java project?

Re: Project (preferably Maven) using JDT [message #672263 is a reply to message #672207] Fri, 20 May 2011 13:25 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You can try the example at http://www.ibm.com/developerworks/opensource/library/os-ast/

ASTMain seems to be a java program using the AST and jdt core compiler.

PW



Re: Project (preferably Maven) using JDT [message #672293 is a reply to message #672263] Fri, 20 May 2011 14:49 Go to previous messageGo to next message
Samuel Cox is currently offline Samuel Cox
Messages: 5
Registered: May 2011
Junior Member
Paul, I had looked at that. Unless I'm missing something, that just has the code using the AST API. I'll eventually get to that.

Anyhow, I just kept adding jars from an Eclipse 3.6.2 Class download until I could run without errors. Not ideal, but I'm just playing at this point.

Thanks for trying to help.

[Updated on: Fri, 20 May 2011 14:49]

Report message to a moderator

Re: Project (preferably Maven) using JDT [message #672298 is a reply to message #672293] Fri, 20 May 2011 15:39 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Samuel Cox wrote on Fri, 20 May 2011 10:49
Paul, I had looked at that. Unless I'm missing something, that just has the code using the AST API. I'll eventually get to that.


Yes, because you asked "Is there a sample project and/or documentation that demonstrates using JDT in a normal (i.e. not Eclipse plugin) Java project?"

Quote:


Anyhow, I just kept adding jars from an Eclipse 3.6.2 Class download until I could run without errors. Not ideal, but I'm just playing at this point.

Thanks for trying to help.


We do try Smile

That being said, what do you think is missing? You have an example of a java-only program that uses the JDT AST. Is it the maven component that's missing? We have the repo at http://maven.eclipse.org, but eclipse is only sorting out a consistent publishing policy right now.

As for finding dependencies, it's compile, run, add jar Smile. I had to use jars for:

org.eclipse.equinox.preferences
org.eclipse.core.contenttype
org.eclipse.osgi
org.eclipse.core.runtime
org.eclipse.core.jobs
org.eclipse.core.resources
org.eclipse.jdt.core
org.eclipse.text
org.eclipse.equinox.common

and an extra, org.eclipse.swt.gtk.linux.x86_64. I only need the SWT one because that example is compiling and launch SWT. The example itself was written against a much earlier version of eclipse, and some of the bundles have since split.

PW


Re: Project (preferably Maven) using JDT [message #672311 is a reply to message #672298] Fri, 20 May 2011 16:15 Go to previous message
Samuel Cox is currently offline Samuel Cox
Messages: 5
Registered: May 2011
Junior Member
I do see your point, but, by sample project, I meant one that told me what the dependencies are. I guess I've been too long in Maven world;) Also, I think the thread is so long that maybe it wasn't clear what I really needed. I wasn't looking for help understanding the API. I was looking for help compiling code that uses the API.

I had to do exactly what you said (compile/run, find dep, add dep, repeat) to get going. It wasn't that painful, and I probably should have gone down that path before bothering you guys with all this. Eventually, I'll be putting this all into a Maven project. I'll fight that pain later though.

Once I make sure the API will do what I want, I'll see if I can resolve all dependencies from your maven.eclipse.org site.

Hopefully, there will only be API questions from now on!
Previous Topic:Really weird Scroll Velocity Behaviour
Next Topic:Eclipse wont open
Goto Forum:
  


Current Time: Tue Sep 23 04:21:21 GMT 2014

Powered by FUDForum. Page generated in 0.02068 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software