How to create a project in IntelliJ

Hi,

My intention is to create a project using the Spring framework in IntelliJ 7.
I'm really new to this so my first question is where can I change the CLASSPATH environment variable?
I suppose I must attach the path to the Spring framework in the CLASSPATH?

3 comments
Comment actions Permalink

To get you started, you an take a look at the Spring & Hibernate demo at http://www.jetbrains.com/idea/training/demos.html#idea7 - it's towards the bottom of the page. Unfortunately many of the "getting started with IDEA demos are a little dated and show older version of IDEA which used a different project configuration interface. (I think JetBrains is working on getting these updated.) But the Spring demo is fairly up to date and should help you.


I suppose I must attach the path to the Spring framework in the CLASSPATH?

As it will show in the demo, you add a Spring facet to your module within your project. IDEA can auto download the Spring jars for some versions of Spring. If you need a version not shown in the Spring Features tab of the Spring Facet configuration, just create a module library, project library, or global library for the Spring version you want to use and add that as a dependency (on the dependencies tab) for you module. The Spring facet will detect that in your class path and change the Spring version on the Spring features tab to match.

Also note that if you already have some project source code, and you create an IDEA project from source, IDEA will auto-detect the existence of Spring (if your project contains a Spring context (i.e. ]]>) configuration file) and set most everything up for you.

Hope that helps. If after watching the demo you still have some questions, post them and someone should be able to help you out.

0
Comment actions Permalink

Hello Mark!

Thank you for your advice! This will be a good start for me.

/Håkan

0
Comment actions Permalink

Hold your horses for a second... First, an important detail. Assuming you are well familiar with the concepts and philosophy behind the Spring Framework, you realize that one of the best and most important things about Spring is its non-intrusiveness. That means that you can - and should - implement most of your generic stuff (domain objects, common utilities, service API, and business services that are reusable among multiple applications) as POJOs, i.e. as ordinary Java classes most of which will not even have any dependencies on Spring at all. For all such modules you do not need Spring facets.

Now, when it comes to putting together a specific application module, then you can take advantage of Spring on a full scale - to glue all your independent modules together using Spring's configuration/dependency injection, to configure your data source, transaction management, etc. Plus, you can provide the application-specific DAO implementations using Spring's data access tier support (ORM support, JdbcTemplate support, etc.) If it is a web application, it may be implemented using Spring MVC, and, possibly Web Flow, etc. So, in other words, it will be just your specific application module that is Spring-dependent, not, necessarily all modules in your project.

Also, keep in mind that if you have a spring configuration XML (or several of them) in your source tree, IntelliJ will detect them and offer to create a Spring facet for that module. Or, if you have decided to configure an existing service implementation in your app using spring, you can just start putting together the configuration XML, and then create a spring Facet using the Module settings. Again, Spring should detect the XML that you've just created. It should also be able to pull the Spring jars into your project from the web or a location you specify.

0

Please sign in to leave a comment.