Maven servlet编译“所有类都是最新的”

时间:2016-06-01 14:08:16

标签: java maven servlets pom.xml

我是maven和servlets的新手,但我绝对是在我的智慧结束。它拒绝在每一个扭曲和转弯时工作,并且由于某种原因,它说“没有什么可以编译 - 所有课程都是最新的”,尽管我已经改变了所有要改变的东西。

这是我的servlet:

@WebServlet("/HelloWorld")
public class HelloWorldServlet extends HttpServlet {

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    response.setContentType("text/html");
    response.setCharacterEncoding("UTF-8");

    String hold = request.getParameter("text");

    try(PrintWriter out = response.getWriter()) {
        out.println("<!DOCTYPE html>");
        out.println("<html>");
        out.println("<body>");
        out.println("<p>"+hold+"</p>");
        out.println("</body>");
        out.println("</html>");
    }
}

}

这是我的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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>pxl.kits</groupId>
  <artifactId>Webcomponents</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>  

  <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <project.build.sourceEncoding>
    UTF-8
    </project.build.sourceEncoding>
  </properties>

  <build>
      <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.0</version>
        </plugin>

        <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.4.12</version>
            <configuration>
                <container>
                <containerId>tomcat8x</containerId>
                <type>installed</type>
                <home>${env.TOMCAT_HOME}</home>
                </container>
                <configuration>
                    <type>existing</type>
                <home>${env.TOMCAT_HOME}</home>
                </configuration>
            </configuration>
        </plugin>       
      </plugins>
  </build>
  <dependencies>
    <dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-web-api</artifactId>
    <version>7.0</version>
        <scope>provided</scope>
    </dependency>
  </dependencies>
</project>

我用来运行/调试的命令:     mvn包装货物:部署

编辑:

   [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Webcomponents 0.0.1-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Webcomponents ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 0 resource
    [INFO]
    [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @Webcomponents -
--
    [INFO] Nothing to compile - all classes are up to date
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources)@Webcomponents ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 0 resource
    [INFO]
    [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) @Webcomponents ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO]
    [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ Webcomponents ---
    [INFO]
    [INFO] --- maven-war-plugin:2.2:war (default-war) @ Webcomponents ---
    [INFO] Packaging webapp
    [INFO] Assembling webapp [Webcomponents] in     [C:\Users\Laurens\workspace\Webcompo
nents\target\Webcomponents-0.0.1-SNAPSHOT]
    [INFO] Processing war project
    [INFO] Copying webapp resources [C:\Users\Laurens\workspace\Webcomponents\src\ma
in\webapp]
    [INFO] Webapp assembled in [41 msecs]
    [INFO] Building war: C:\Users\Laurens\workspace\Webcomponents\target\Webcomponen
ts-0.0.1-SNAPSHOT.war
    [INFO] WEB-INF\web.xml already added, skipping
    [INFO]
    [INFO] --- cargo-maven2-plugin:1.4.12:deploy (default-cli) @ Webcomponents ---
    [INFO] [edDeployerDeployMojo] Resolved container artifact org.codehaus.cargo:car
go-core-container-tomcat:jar:1.4.12 for container tomcat8x
    [INFO] [stalledLocalDeployer] Deploying [C:\Users\Laurens\workspace\Webcomponent
s\target\Webcomponents-0.0.1-SNAPSHOT.war] to [C:\apache-tomcat-8.0.35/webapps].
..
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 3.063 s
    [INFO] Finished at: 2016-06-01T16:15:00+02:00
    [INFO] Final Memory: 12M/200M
    [INFO] ------------------------------------------------------------------------

0 个答案:

没有答案