1. 程式人生 > >idea 執行 mvn clean 的時候報錯

idea 執行 mvn clean 的時候報錯

此時首先執行一下  mvn   compile,看看報不報錯,如果不報錯那麼在  pom.xml中的  <build> 標籤後面增加一句  

<defaultGoal>compile</defaultGoal>

如下

<build>
   <defaultGoal>compile</defaultGoal>
   <plugins>        <!-- <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> 
         </plugin> -->
      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-dependency-plugin</artifactId>
         <executions>
            <execution>
               <id>copy</id>
               <phase>package</phase>
               <goals>
                  <goal>copy-dependencies</goal>
               </goals>
               <configuration>
                  <outputDirectory>${project.build.directory}/lib</outputDirectory>
               </configuration>
            </execution>
         </executions>
      </plugin>
   </plugins>

</build>

2、此時如果執行mvn  clean install   還報錯 ,那麼檢視 pom.xml的許可權,看看自己的使用者用沒有許可權,如果是 root 許可權,那麼別的使用者執行mvn clean就會報錯。

ll   pom.xml  

給自己的使用者授權

chown -R   user1:user1   pom.xml  

此時就可以了