1. 程式人生 > >Maven專案下Invalid classpath publish/export dependency報錯

Maven專案下Invalid classpath publish/export dependency報錯

在控制檯輸入mvn eclipse:eclipse 

中途報錯goal requires project to excute but there is no POM in this directory

出錯原因是沒有進到擁有pom.xml資料夾下進行操作 cd到相應的資料夾後再次輸入mvn eclipse:eclipse即可

再不行在pom.xml裡新增

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <additionalProjectnatures>
                        <projectnature>org.eclipse.jdt.core.javanature</projectnature>
                        <!-- 
                        <projectnature>org.eclipse.m2e.core.maven2Nature</projectnature>
                        <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                         -->
                    </additionalProjectnatures>
                    <additionalBuildcommands>
                        <buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
                        <!-- 
                        <buildcommand>org.eclipse.m2e.core.maven2Builder</buildcommand>
                        <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
                         -->
                    </additionalBuildcommands>
                </configuration>

            </plugin>

然後輸入

mvn eclipse:clean

mvn eclipse:eclipse