使用maven项目在netbeans中运行应用程序,说没有要编译的源代码

时间:2010-02-11 22:04:51

标签: java maven-2 netbeans

当我运行应用程序时,它说:

[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.

这是字符串,我唯一名为HomeController的.java文件位于以下文件夹中:

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

我首先在eclipse中构建了这个应用程序,但无法让它工作,所以我在netbeans中打开它。它是第一次我只是通过运行来运行它,但我想将上下文从http://localhost:8080/springmvc2/更改为http://localhost:8080/,一旦我做了更改,我构建它并且现在遇到了一些问题。

我的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">
    <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</url>
    <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 个答案:

答案 0 :(得分:2)

将您的控制器从src/main/resources移至src/main/java:)