Why does Netbeans IDE not automatically delete Build from a web java application that was imported? [closed]

1

I downloaded a java web project and imported it to netbeans , when all the imported project with all its libraries were in their place, along with the file web.xml (within WEB-INF), I executed the project and it started tomcat and in the browser the application worked satisfactorily! So far so good! But when I try to clean and build the project on IDE netbeans it indicates an error saying that it can not delete the build directory !!

The project respected the folder hierarchy of a web application, as illustrated in the figure below:

Below is the erro that IDE reports:

Deleting directory C: \ Users \ User \ Documents \ NetBeansProjects \ Projects \ SimpleJspServletDB-master \ build
C: \ Users \ User \ Documents \ NetBeansProjects \ Projects \ SimpleJspServletDB-master \ build-impl.xml: 1439: Unable to delete file C: \ Users \ web \ WEB-INF \ classes \ db.properties
CONSTRUCTION FAIL (total time: 6 seconds)

    
asked by anonymous 29.08.2015 / 22:35

1 answer

3

Sometimes when you download an example of the internet for learning you may come across an older version of code for your IDE and this may lead to some conflicts. It's always good to take a look at the code to see the file versions used in the web.xml file and compare them with the current ones you are using in your container (in my case TOMCAT) !!

The problem is the web.xml descriptor. It can not automatically clean and build with the IDE because the header of the web.xml file (application descriptor) that came with the project is wrong:

<?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">

REPLACE BY

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
  http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"  version="3.1">
    
30.08.2015 / 16:11