views:

19

answers:

1

When I run the application, it says:

[resources:resources]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
Copying 1 resource
[compiler:compile]
No sources to compile
[resources:testResources]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
skip non existing resourceDirectory E:\dev\netbeans\springmvc2\src\test\resources
[compiler:testCompile]
No sources to compile
[surefire:test]
No tests to run.

It's string, my only .java file named HomeController is in the following folder:

/Other Sources
/Other Sources/src/main/resources
/Other Sources/src/main/resources/com.example.web/HomeController.java

I first built this app in eclipse, but couldnt' get it to work, so I opened it up in netbeans. It worked the first time I ran it just by doing Run, but I wanted to change the context from http://localhost:8080/springmvc2/ to http://localhost:8080/ and once I did the change, I built it and now having some issues.

my pom.xml:

<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/maven-v4_0_0.xsd"&gt;
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>springmvc2</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>springmvc2 Maven Webapp</name>
    <url>http://maven.apache.org&lt;/url&gt;
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>

        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>3.0.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>3.3.2.GA</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-annotations</artifactId>
            <version>3.4.0.GA</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>3.0.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.mod4j.org.apache.commons</groupId>
            <artifactId>logging</artifactId>
            <version>1.0.4</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1.1</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>springmvc2</finalName>
        <filters>
        </filters>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>          
                <configuration>             
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
+1  A: 

Move your controller from src/main/resources to src/main/java :)

Pascal Thivent
who or where does it specify where my source files have to be? Is it the maven type I chose? (I chose webapp)
Blankman
@Blankman With maven, sources go *by default* in `src/main/java` for a jar, war, ejb, etc, the project "type" doesn't change anything. See this reference http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html. Maven won't try to compile files that are in `src/main/resources`, these files are just made available on the class path, but not compiled.
Pascal Thivent