is maven required to develop spring based project? - eclipse

I am developing (Single developer) a Spring based project for a Traveling based website.
and this is my first Spring based project, I want to use Maven in my project, because hosting sites like Cloud Bees expecting maven based project for deployment.
Is Maven required to develop Spring based project in Single developer environment.
FYI I am using eclipse IDE.

No it is not required.
You can develop in Spring using Ant or Maven or Gradle etc. or nothing at all.
Although it might be easier to do it with Maven (for library management)

It is not required per se, but you will run into some serious pain down the road if you don't use Maven or Gradle.
The first and foremost reason to use Maven or Gradle is to be able to very simply run tasks that occur ofter (like building a war or running the tests) and to be able to declaratively obtain the required dependencies (which in the case of a typical Spring application are plentiful).
If you are just starting to use build tool, I would suggest you take look at Gradle instead of Maven.

Related

Initial setup of a Spring project

I'm having trouble grasping the correct way of developing a Spring application. I'm following through the tutorial found here: https://spring.io/guides/gs/rest-service/
I understand from reading the instructions that Gradle will download the specified dependencies, but that's only during the build phase. During the development phase, am I supposed to manually download the JAR files and include them as libraries in my Eclipse project?
There are plugins for eclipse that will help you use gradle to develop:
http://gradle.org/tooling
Follow the link here for detailed instructions:
https://github.com/spring-projects/eclipse-integration-gradle/
There's also this. I'm not sure if they are the same plugin:
http://marketplace.eclipse.org/content/gradle-integration-eclipse-44
Manually loading the jars kind of defeats the purpose of using a dependency management tool.
If you want to use an Eclipse-based IDE, you can also use the Spring Tool Suite. It has all the required plugins to develop Spring applications with Gradle or Maven. (http://spring.io/tools/sts)

Maven Eclipse Integration

I have recently started out on Maven. I am trying to integrate Maven+eclipse(Juno)+tomcat7.
I have downloaded m2e-wtp plugin for eclipse and created a Maven project whose structure follows a standard Maven project structure. It is also configured a dynamic web project.
It is a multi module project with two modules of flex(f1 AND f2) and one module of webapp(w).I have configured all the plugins correctly and there is no problem with configuration of POMs.
What I want to achieve is :
When I clean and Build project in Eclipse using Project-->Clean,Eclipse does not build the war in target folder of my web application project (w). I also does not copy any of the flex resources to target folder. However,
When I run the project as maven build by right-clicking the web application project and running it as a "maven install" it creates everything as expected.
My question is that if it is possible to achieve what I mentioned in point (1)? Or the only correct way to do this is the way mentioned in point (2).
I am also not able to deploy the generted files in step 2 automatically in tomcat.
Do I need to use another maven plugin for this?
Please note that this i my first experience with Maven + eclispe. I have followed certain tutorials. So, Please be lenient while voting negatively.
From what I know it is not possible to force Eclipse to use Maven directly (I would gladly be proven wrong).
Eclipse does not use Maven to build (1). Using the m2e plugin, it is possible to run maven to perform the build as you discovered (2).
If you are looking for that kind of tight integration you can look at NetBeans or IntelliJ who are using Maven natively.
EDIT:
About (3) there is a Tomcat-Maven-Plugin that can deploy the WAR file created on a running tomcat instance. Check the Usage page for more details.

Build tool for Scala web application development

While working with Scala frameworks such as Play! and Lift I was really amazed how these frameworks manage to create a full development stack from the source code up to the web application container (Jetty).
Right now I'm trying to configure a project on my own with the following features:
Automatic deployment on Tomcat 7 (I'm not using Jetty as I require JEE6 support)
WAR file packaging
Is it possible to do it with a build tool such as SBT or Maven?
Note: My goal is to create my own project structure, not using an existing framework (even though I'm taking some ideas from them).
There is a web plugin for SBT:
https://github.com/JamesEarlDouglas/xsbt-web-plugin
It gives you war packaging, but not automatic deployment (other than on Jetty, which it integrates, but which you don't have to use).
That said, I'd like to see a fork of that plugin that removes the Jetty dependency and adds an automatic external deployment option. Shouldn't be too hard to do.

Compiling and running an OSGI application in Eclipse

The base of our enterprise application is OSGI and we have several Java projects that are logically OSGI bundles. We use Maven to compile the application using the Maven Bundle plugin. But this process is time consuming and makes it impossible to debug the application. We also use the Runner and Pax(:provison) plugins to run the application. If we could rely on the Auto build function of Eclipse and also debug the application it would make our lives so much easier. Is there a way to configure Eclipse to be able to compile (and may be run) an OSGI-based application?
I'm not entirely sure if I understand you, but here goes.
Well, running/debugging OSGi applications in Eclipse is really easy, as long as your bundles reside in PDE aware projects or at least are on your target platform.
Do you have the source of all your bundles? Debugging without source isn't all that useful. If you do, can you just import all the source of your bundles into your Eclipse workspace?
Otherwise you can create a target platform, add all your bundles to that. (as a first attempt, I'd say dump all your bundles in a directory and point the target platform there)
Either way, then you should be able to Run (or debug)-> OSGi framework -> New -> Pick your bundles -> Start
You can both pick bundles from or target platform and from your workspace.
For building, you can use Eclipse Plugin Development Environment (PDE). Despite its name, it isn't specific to building Eclipse plugins and can be used for working on pure OSGi bundles. Eclipse plugins are OSGi bundles with some extras.
Cannot help you with the running or debugging part, although I do know that some enterprise-oriented OSGi platforms provide extensions to PDE.
If you're already using the maven bundle plugin, you may find that PDE's manifest-first approach isn't a good fit with your existing code-first build (I assume at the end you want both an IDE build for development and debugging, and a command-line build for continuous integration and automated testing).
You have two choices. As others have suggested, you can use Eclipse's integrated PDE, and use Tycho for your maven build. Tycho uses the same data used by PDE, so you don't have to write things down more than once. Alternatively, you can stick with the maven bundle plugin and use bndtools within Eclipse. Like the bundle plugin, bndtools is code-first, so you won't need to worry about maintaining manifests. However, you may find there isn't quite as big a set of features in bndtools as in PDE, and I'd suggest still checking your manifests by hand to make sure you understand what's being generated. Whether you prefer manifest-first or code-first is a bit of a heated philosophical debate.
Look at bndtools. bndtools is using the same bnd that is underlying the maven bundle plugin. You can even use bndtools together with m2e. bndtools is available from the Eclipse market place.

How can a maven build process be retrofitted to an eclipse developed plugin?

The eclipse plugin development environment is a pretty handy tool when creating from scratch a set of OSGi bundles that need to work together. Particularly this is true when trying to get all the package imports and exports and other manifest fluff right during development, or if there are third party jars that need to be embedded. But trying to retrofit a maven build process around this afterwards seems to be pretty tricky, mainly because most of the maven plugins for bundling/OSGi build the manifest themselves, whereas using the PDE, you are handcrafting the manifest.
What is the best way to retrofit a maven build process to a bunde/set of bundles, that dont respect the standard maven project layout, and already have handcrafted manifests?
Use Tycho. It lacks some documentation, but it does just that: builds the plugins using the PDE semantics (actually, it uses PDE compiler internally). So, all you need is to create almost empty pom.xml's for your modules.