views:

65

answers:

2

I am new to maven. The main feature I benefit from, yet, is the automatic dependency management. The standardized directory structure seems also to be nice, but Eclipse has a standard directory structure, too. The directory structure is now independent from Eclipse, but now it is dependent from maven. OK, I see, both programs seem to be quite flexible at this point.

I am not quite sure, if maven is more dedicated to servers or to client systems, e.g. there is a feature / plugin to generate a project website. Doesn't this make most sense on a server system?

How to integrate maven with a version control system (VCS), e.g. SVN? I think of a system where there is a repository and always up-to-date website with download section for development artifacts.

How to integrate maven with Eclipse? I'm now using m2eclipse with WTP integration. Its ok, but it has some behaviors that I don't like, e.g.:

  • When I generate new Java projects the JRE version is set to 1.4 . I have to reset it to 1.6 / workspace default manually.
  • Facets configuration is not stable. Some configurations have to be done manually and in a specific order.

Maybe I can fix them if I read more about it. And I have a more or less serious problem with its WTP extension. I think its important to say, that the WTP extension is not officially supported and may not have production quality.

I know there is another plugin which integrates maven into Eclipse. I did not try it, yet. Is it better?

Also I think, that maven may be useful for much more areas. For example the directory structure could be extended to hold e.g. requirements, specification and modeling artifacts. I think that would only work, if it would be standardized. Revision control for all documents would be nice, too.

So many thing, that could be integrated to support the complete software development prosess. Maybe its unrealistic, to get all of these features. For now the Eclipse integration with WTP and VCS integration have the highest priority for me.

Any suggestions? Thanks in advance.

+1  A: 

Some random points to push you in the right direction:

The standardized directory structure seems also to be nice, but Eclipse has a standard directory structure, too

  • Eclipse does not have a "standard" directory structure. For example, some people put their unit tests in src next to their code, and others put it in a separate dir like tests or test. You can configure either up as much as you want, but Maven follows has defaults that almost everyone follows:
  • source in src/main/java
  • tests in src/test/java
  • resources necessary for running in src/main/resources
    • language files
    • Spring config files
  • resources necessary for running tests
    • golden results
    • config files in src/main/config
  • Eclipse is an IDE, and Maven is a built build management tool
  • case in point: if you ask Eclipse to build a JAR/WAR, you have to manually tell it what to include and where. Because you placed your files in Maven's defaults, you get things like:
    • JARs/WARs contain the compiled Java classes from src/main/java, but not the ones from src/test/java
    • config files from src/main/config don't go into the JAR/WAR (kinda defeats the purpose of a config file if it did)
    • test resources from src/test/resources don't go into the JAR/WAR
  • if you decide to build an assembly (Maven speak for a distribution of your code you can put on your website that includes documentation, source, binaries, etc.), it can make a JAR, the config files, and javadocs into a ZIP file.

I am not quite sure, if maven is more dedicated to servers or to client systems, e.g. there is a feature / plugin to generate a project website.

Yeah, the Maven site plugin.

Doesn't this make most sense on a server system?

Not really. Documentation is critical for any project, especially for client systems.

Maybe I can fix them if I read more about it. And I have a more or less serious problem with its WTP extention. I think its important to say, that the WTP extension is not officially supported and may not have production quality.

Because Maven integration with Eclipse via the m2eclipse plugin isn't perfect, I actually won't use it for WTP projects. I use the Maven Eclipse plugin to generate Eclipse project files and then import the project as a regular Eclipse project. The downside is that the Eclipse project files have to be re-run after any significant changes to the project.

Revision controll for all documents would be nice, too.

That's not Maven, or any build management tool. That's your SCM, Subversion or whatever.

When I generate new Java projects the JRE version is set to 1.4 . I have to reset it to 1.6 / workspace default manually.

You can set that through Maven.

Maybe its unrealistic, to get all of these features. For now the Eclipse integration with WTP and VCS integration have the highest priority for me.

The m2eclipse plugin and friends work best for simple Java Maven projects. Personally, I use the Maven eclipse plugin to generate an Eclipse project for any web, EJB, etc. projects.

There's downsides to that as mentioned earlier, but the upsides, including dependency management as you mentioned, outweigh them, IMHO.

Of course, a poorly configured Maven project is still a poorly configured project. It's not magic. :)

The Alchemist
Thanks for answering. You helped to clarify things, too. :) Just another question: Where to put a config file, that is needed at runtime? into resources, right? One might have thought to put it into config. Thats some of the points, that the maven website does not explain enough. http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
MasterOfAllComputerFreaks
Glad I helped! Anyways, as to your question: depends on whether it's an "external" or "internal" config file. The stuff in `src/main/config` doesn't end up in JAR/WAR/etc.So, Hibernate mapping files or Spring config files should go in `src/main/resources`. `log4j.properties` should go in `src/main/config`. Does that make sense?
The Alchemist
+1  A: 

The directory structure is now independent from Eclipse, but now it is dependent from maven. OK, I see, both programs seem to be quite flexible at this point.

Yes, they are both flexible so we could bend one or the other. But if I had to choose a layout, I would pick the IDE agnostic one i.e. the Maven layout and I would stick to the defaults to minimize the efforts and because they are well known (so anybody familiar with Maven knows where to find things). And if someone wants to use IntelliJ IDEA or NetBeans because he feels more productive with it, he can do it. In other words, I don't see any benefit to use the Eclipse layout.

I am not quite sure, if maven is more dedicated to servers or to client systems, e.g. there is a feature / plugin to generate a project website. Doesn't this make most sense on a server system?

Maven can be used for local builds on developer machines, for central builds on a continuous integration machine. And things like generating a website, deploying artifacts are usually done on the central server.

How to integrate maven with a version control system (VCS), e.g. SVN? I think of a system where there is a repository and always up-to-date website with download section for development artifacts.

I didn't really understand the first part of the question. How do you want to integrate Maven with SVN exactly (there is the maven-release-plugin but I'm not sure that's what the question is about)? For the second part, the traditional approach is to use a continuous integration server to trigger a build after a change in the VCS and to deploy (in the maven sense) the created artifacts to a "corporate repository". Many people use Hudson as CI server.

When I generate new Java projects the JRE version is set to 1.4 . I have to reset it to 1.6 / workspace default manually.

That's because the maven project itself is not configured to use 1.6 level (the Eclipse configuration is derived from the POM, which makes sense). You have to configure the maven compiler plugin for 1.6. Here is one way to do it (there are plenty of previous questions on this topic):

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>2.3.1</version>
  <configuration>
    <source>1.6</source>
    <target>1.6</target>
  </configuration>
</plugin>

And then update your project configuration under Eclipse via right-click then Maven > Update Project Configuration.

Facets configuration is not stable. Some configurations has to be done manuel and in a specific order.

They are for me and again, they are derived from your POM (e.g. from the version of your web.xml).

And I have a more or less serious problem with its WTP extention. I think its important to say, that the WTP extension is not officially supported and may not have production quality.

Huh? Where did you read this? Works fine for webapps for me.

I know there is another plugin which integrates maven into Eclipse. I did not try it,yet. Is it better?

I don't have experience with Eclipse IAM. But what is your problem with m2eclipse?

Also I think, that maven may be useful for much more areas. For example the directory structure could be extended to hold e.g. requirements, specification and modeling artifacts. I think that would only work, if it would be standardized. Revision control for all documents would be nice, too.

You're free to put whatever you want in your project tree. Many people are doing this and referring to docs from the site. Possibilities are endless.

Pascal Thivent
Thanks for answering. http://maven.40175.n5.nabble.com/wtp-projects-dependencies-don-t-show-up-in-embedded-tomcat-WEB-INF-lib-directory-td139868.html#a139868 The link forwards you to a web view of a m2eclipse mailing list. The problem described there is exactly the problem I have with m2eclipse's wtp extension. There is said that the wtp extension is not officially supported. I think I will try the IAM plugin and the maven eclipse plugin, if I don't get this fixed. I think I can use maven better now, thanks.
MasterOfAllComputerFreaks
Thanks for editing the listing format. How did you do it?
MasterOfAllComputerFreaks
@Master Thank you very much for the link (that you could even add in the question). I know that the WTP extension doesn't do everything (like EAR support) but I was not aware of the official position. But don't misinterpret Jason, it works fine in most cases and I'm happy with it. Can't say anything about IAM but I've been a happy maven-eclipse-plugin user for a long time and, while I liked it because it's lightweight, it doesn't support things like filtering, which I use intensively. That's why I prefer m2eclipse now that it's usable.
Pascal Thivent