Search code examples
springmavenmaven-pluginspring-room2eclipse

Spring Roo Jpa Setup fails, maven-eclipse-plugin issue?


I'm using spring roo version 1.2.3. Just a few days ago, the project creation with any package worked fine. But recently, if I create a project with WAR or POM packaging, then the Jpa Setup command doesn't work.

I give the command

project --topLevelPakage com.example.test --packaging POM
Created ROOT/pom.xml

Then I type:

jpa setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY

it returns

additionalBuildCommands element of the maven-eclipse-plugin required

I have searched in so many places to find the root of this problem. But without any success. I have checked the pom.xml and indeed the additionalBuildCommand element is present there.

<plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-eclipse-plugin</artifactId>
                    <version>2.7</version>
                    <!-- Note 2.8 does not work with AspectJ aspect path -->
                    <configuration>
                        <downloadSources>true</downloadSources>
                        <downloadJavadocs>false</downloadJavadocs>
                        <wtpversion>2.0</wtpversion>
                        <additionalBuildcommands>
                            <buildCommand>
                                <name>org.eclipse.ajdt.core.ajbuilder</name>
                                <arguments>
                                    <aspectPath>org.springframework.aspects</aspectPath>
                                </arguments>
                            </buildCommand>
                            <buildCommand>
                                <name>org.springframework.ide.eclipse.core.springbuilder</name>
                            </buildCommand>
                        </additionalBuildcommands>
                        <additionalProjectnatures>
                            <projectnature>org.eclipse.ajdt.ui.ajnature</projectnature>
                            <projectnature>com.springsource.sts.roo.core.nature</projectnature>
                            <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                        </additionalProjectnatures>
                    </configuration>
                </plugin>

Then what is causing the problem? Any help would be greatly appreciated. Thanks in advance.


Solution

  • Packaging pom?

    Roo supports 4 Maven packaging types out of the box:

    • jar. The default, try with this (or don't specify packaging at all)
    • war. For web projects
    • bundle. For OSGI
    • pom. For multi-module Maven projects.

    The later should contain only a pom and a set of folders, that will be the leaf maven projects (jar, war, and so on)