aaaaa
aaaaa

Reputation: 67

Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.1.0:clean (default-clean) on project spring-boot-keycloak

My application was working fine and i was able to do mvn clean install using <packaging>jar</packaging> and able to execute a jar file but i change it to war file and i was't able to do mvn clean install .

is there any deference between these too ? I looked for more solutions but with no luck

Error :

Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.1.0:clean (default-clean) on project spring-boot-keycloak: Failed to clean project: Failed to delete C:\Users\user\Documents\New folder\E.Services\target

My POM File :

<?xml version="1.0" encoding="UTF-8"?>
<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>com.baeldung.keycloak</groupId>
    <artifactId>spring-boot-keycloak</artifactId>
    <version>0.0.1</version>
    <name>spring-boot-keycloak</name>
    <packaging>war</packaging>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.2.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.keycloak.bom</groupId>
                <artifactId>keycloak-adapter-bom</artifactId>
                <version>3.3.0.Final</version>
                <type>pom</type>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>


<-- Many dependencies -->

    </dependencies>
    <repositories>
        <repository>
            <id>central</id>
            <name>Maven Plugin Repository</name>
            <url>https://repo.maven.apache.org/maven2</url>
            <layout>default</layout>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <releases>
                <updatePolicy>never</updatePolicy>
            </releases>
        </repository>

    </repositories>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <executable>true</executable>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Upvotes: 1

Views: 4306

Answers (3)

Rushya Harika
Rushya Harika

Reputation: 1

There can be many causes for this error. One of the main reasons could be that the directory maven is trying to delete is locked. Try to access the directory that maven is trying to delete. If you get a prompt like "the file or directory is corrupted or unreadable", try fixing disk errors. It worked for me. The steps I followed are:

  1. Launch CMD on your Windows PC via the Start Menu. Right click on it to run it as administrator.
  2. Type chkdsk /f x: in the Command Prompt window and press Enter to execute the command. X here is the drive letter of the corrupted partition that you want to check. Please replace it with your own drive letter.

Upvotes: 0

Liye.zhang
Liye.zhang

Reputation: 1

it's a file system issue a pretty common problem actually -- you probably have a file open or a Windows Explorer open in your ${project.home}/target directory...

Upvotes: 0

Greg Patnude
Greg Patnude

Reputation: 49

unable to delete target -- it's a file system issue a pretty common problem actually -- you probably have a file open or a Windows Explorer open in your ${project.home}/target directory...

Upvotes: 0

Related Questions