royjavelosa
royjavelosa

Reputation: 2068

Maven Fatal Error on struts2-archetype-blank

I'm trying to start a new struts 2 project using maven (struts2 blank archetype) The code below runs and generates the project along with its pom.xml

D:\Dev\IndigoWS>mvn archetype:generate -B DgroupId=com.proj.core -DartifactId=MyStruts2Blank -DarchetypeGroupId=org.apache.struts -DarchetypeArtifactId=struts2-ar
chetype-blank -DarchetypeVersion=2.2.1

with the following stacktrace from the terminal.

[INFO] Building Maven Default Project
[INFO]    task-segment: [archetype:generate] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] Preparing archetype:generate
[INFO] No goals needed for project - skipping
[INFO] [archetype:generate {execution: default-cli}]
[INFO] Generating project in Batch mode
[INFO] Archetype repository missing. Using the one from [org.apache.struts:strut
s2-archetype-blank:2.2.3] found in catalog remote
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------

but whenever I try to convert it into an eclipse project using the command

mvn eclipse:eclipse -Dwtpversion=1.5

I encountered the fatal error below

D:\Dev\MyWorkspace>cd MyStruts2Blank

D:\Dev\MyWorkspace\MyStruts2Blank>mvn eclipse:eclipse -Dwtpversion=1.5

[INFO] Scanning for projects... [INFO]--------------------------------------------------------------------------------- [ERROR] FATAL ERROR
[INFO]------------------------------------------------------------------------------------------------------------------------ [INFO] Error building POM (may not be this project's POM).

Project ID: com.proj.core:MyStruts2Blank POM Location: D:\Dev\MyWorkspace\MyStruts2Blank\pom.xml

the pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.royj.core</groupId>
    <artifactId>MyStruts2Blank</artifactId>
    <version>${project.version}</version>
    <packaging>war</packaging>
    <name>Struts 2 Blank Webapp</name>

    <properties>
        <struts2.version>${project.version}</struts2.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>${struts2.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-config-browser-plugin</artifactId>
            <version>${struts2.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-junit-plugin</artifactId>
            <version>${struts2.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1.1</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.5</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-mock</artifactId>
            <version>2.0.8</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>2.5</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.0</version>
            <scope>provided</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>6.1.21</version>
                <configuration>
                    <scanIntervalSeconds>10</scanIntervalSeconds>
                    <scanTargets>
                        <scanTarget>src/main/webapp/WEB-INF</scanTarget>
                        <scanTarget>src/main/webapp/WEB-INF/web.xml</scanTarget>
                        <scanTarget>src/main/resources/struts.xml</scanTarget>
                        <scanTarget>src/main/resources/example.xml</scanTarget>
                    </scanTargets>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

and the maven version

Apache Maven 2.2.1 (r801777; 2009-08-07 03:16:01+0800)
Java version: 1.6.0_24
Java home: C:\Program Files\Java\jdk1.6.0_24\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"

What do I need to do to fix this and successfully generate a struts 2 blank archetype. I can successfully create a starter archetype for struts 2 using maven but with no success for the blank archetype. Is the blank archetype no longer available? By the way I am using Eclipse Indigo Version: Indigo , Release Build id: 20110615-0604 Thanks in advance guys.

Upvotes: 0

Views: 802

Answers (1)

khmarbaise
khmarbaise

Reputation: 97359

The first i have to say don't use mvn eclipse:eclipse in relationship with Eclipse Indigo anymore, cause you have m2e as part of Indigo furthermore install m2e wtp plugin via Eclipse Marketplace. Where is your project.version defined, cause you are using it in relationship with your struts version but in your pom you didn't define any version.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.royj.core</groupId>
    <artifactId>MyStruts2Blank</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>Struts 2 Blank Webapp</name>

    <properties>
        <struts2.version>2.3.1.2</struts2.version>
    </properties>
...
</project>

Apart from that i would suggest to upgrade to Maven 3.0.3 cause Eclipse Indigo uses a Maven 3. embedded.

Upvotes: 1

Related Questions