【发布时间】:2014-02-07 19:06:23
【问题描述】:
我是 maven 新手,正在尝试运行简单的 spring 演示。我使用 Intellij IDEA 作为我的 IDE。我正在关注here提供的教程。
所以我跑了
mvn archetype:generate -DgroupId=SpringDemo -DartifactId=SpringExamples
-DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
然后做了
mvn idea:idea
它生成了所有 .ipr,.iws 等文件。然后我只是从 IDEA 打开并选择了 .ipr 文件。它检测到它是 IDEA 项目并打开它,但它给了我以下错误
Package name 'cospring' does not correspond to the file path 'cospring-demo'
应用类是
package cospring-demo;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
有什么问题?有什么解决办法吗?
【问题讨论】:
-
我认为
cospring-demo不是一个有效的包名(包含连字符)尝试在你的类中使用cospringApp。 -
你真的不应该使用
mvn idea:idea。它已过时:stackoverflow.com/a/11903127/1350762.
标签: java maven intellij-idea