简体   繁体   中英

Intellij 13 not saving/compiling on debug

I had been using Intellij 13 for awhile and it was amazing. I got a new hard drive 500 ssd and had to install it. I got my project back on my hard drive, (which I had to redo everything because Intellij did not like importing my project). But now everything works perfect except the compiler. I hit debug and nothing seems to work correctly. Come to find out none of the code is being saved/compiled unless I do a clean install with maven. I am not even sure where to start looking. I went into the settings and enabled some of the java compiler settings but to no avail. Any suggestions or ideas of where to start looking?

I am running JSF with Apache Tomcat.

The Pom

    <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.mkyong.common</groupId>
  <artifactId>JavaServerFaces</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>JavaServerFaces Maven Webapp</name>
  <url>http://maven.apache.org</url>

  <repositories>
    <repository>
       <id>java.net.m2</id>
       <name>java.net m2 repo</name>
       <url>http://download.java.net/maven/2</url>
     </repository>
  </repositories>

  <dependencies>

    <!-- MySQL database driver -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.9</version>
    </dependency>

    <!-- Spring framework --> 
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring</artifactId>
        <version>2.5.6</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>2.5.6</version>
    </dependency>

    <!-- For Java EE Application Server, uncomment this library 
    and comment the rest of the libraries
    <dependency>
      <groupId>javax.faces</groupId>
      <artifactId>jsf-api</artifactId>
      <version>2.0</version>
      <scope>provided</scope>
    </dependency>
    -->

    <!-- For Servlet Container like Tomcat -->
    <!-- http://download.java.net/maven/2 -->
    <dependency>
      <groupId>com.sun.faces</groupId>
      <artifactId>jsf-api</artifactId>
      <version>2.1.0-b03</version>
    </dependency>

    <dependency>
      <groupId>com.sun.faces</groupId>
      <artifactId>jsf-impl</artifactId>
      <version>2.1.0-b03</version>
    </dependency>

    <!-- EL 2.2 to support method parameter in EL -->
    <dependency>
      <groupId>org.glassfish.web</groupId>
      <artifactId>el-impl</artifactId>
      <version>2.2</version>
    </dependency>


    <!-- http://repo1.maven.org/maven2/ -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.5</version>
    </dependency>

    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>jsp-api</artifactId>
      <version>2.1</version>
    </dependency>

    <!-- too old
    <dependency>
      <groupId>com.sun.el</groupId>
      <artifactId>el-ri</artifactId>
      <version>1.0</version>
    </dependency>
   -->

   <!-- Commons Validator 
   <dependency>
        <groupId>commons-validator</groupId>
        <artifactId>commons-validator</artifactId>
        <version>1.3.1</version>
   </dependency>

   <dependency>
        <groupId>oro</groupId>
        <artifactId>oro</artifactId>
        <version>2.0.8</version>
   </dependency>
    -->

  </dependencies>

  <build>
    <finalName>JavaServerFaces</finalName>

    <plugins>
       <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
           <version>2.3.1</version>
           <configuration>
               <source>1.6</source>
               <target>1.6</target>
           </configuration>
       </plugin>
    </plugins>
  </build>
</project>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    id="WebApp_ID" version="2.5">

  <display-name>JavaServerFaces</display-name>

  <resource-ref>
    <description>MySQL Datasource example</description>
    <res-ref-name>jdbc/mkyongdb</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>


  <!-- Change to "Production" when you are ready to deploy -->
  <context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
  </context-param>

  <!-- Welcome page -->
  <welcome-file-list>
    <welcome-file>faces/default.xhtml</welcome-file>
  </welcome-file-list>

  <!-- JSF mapping -->
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <!-- Map these files with JSF -->
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.faces</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>

    <filter>
        <filter-name>LoginFilter</filter-name>
        <filter-class>com.mkyong.LoginFilter</filter-class>
    </filter>
    <!-- Set the login filter to secure all the pages in the /secured/* path of the application  -->
    <filter-mapping>
        <filter-name>LoginFilter</filter-name>
        <url-pattern>/secured/*</url-pattern>
    </filter-mapping>

    <!-- By default go to secured welcome page -->
    <welcome-file-list>
        <welcome-file>secured/welcome.xhtml</welcome-file>
    </welcome-file-list>
</web-app>

Two things I can think of doing as a quick fix, either 'Invalidate Caches/Restart' by going to File > Invalidate Caches/Restart. Or try importing the project again as a maven project.

Do you have any errors in the 'Event Log'?

Intellij opens a project in two ways (depending on your needs). If you opened a project it will debug normally. In your case, your project lost it's debug configurations. Please open Run/Debug Configurations, reconfigurate (like a new project) and click Apply and click OK. Then try debugging again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM