(題外話:GameLogic 模塊沒有被匯入任何地方,可以被忽略。
正如你在下面的圖片中所看到的,"ConsoleApp "的java檔案旁邊標有"[DesktopApp]",但DesktopApp模塊卻沒有。ConsoleApp和DesktopApp模塊的pom.xml都沒有互相參考,那么IntelliJ為什么會這樣標注源檔案夾呢?
ConsoleApp/pom.xml:
<?xml version="1.0" encoding="UTF-8"? >
<project xmlns="http://maven.apache.org/POM/4.0.0"/span>
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"/span>>
<parent>
<artifactId>/span>TicTacToe</artifactId>
<groupId>com.example</groupId>
<version>1.0.0-SNAPSHOT</version>/span>
</parent>/span>
<modelVersion>/span>4.0.0</modelVersion>/span>
<artifactId>ConsoleApp</artifactId>
<properties>/span>
<maven.compiler.source>16</maven.compiler.source>/span>
<maven.compiler.target>/span>16</maven.compiler.target>/span>
</properties>
</project>/span>
DesktopApp/pom.xml:
<?xml version="1.0" encoding="UTF-8"? >
<project xmlns="http://maven.apache.org/POM/4.0.0"/span>
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"/span>>
<parent>
<artifactId>/span>TicTacToe</artifactId>
<groupId>com.example</groupId>
<version>1.0.0-SNAPSHOT</version>/span>
</parent>/span>
<modelVersion>/span>4.0.0</modelVersion>/span>
<artifactId>DesktopApp</artifactId>
<properties>/span>
<maven.compiler.source>16</maven.compiler.source>/span>
<maven.compiler.target>/span>16</maven.compiler.target>/span>
</properties>
</project>/span>
pom.xml(父級pom.xml):
<?xml version="1.0" encoding="UTF-8"? >
<project xmlns="http://maven.apache.org/POM/4.0.0"/span>
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"/span>>
<modelVersion>/span>4.0.0</modelVersion>/span>
<groupId>com.example</groupId>
<artifactId>TicTacToe</artifactId>
<packaging>/span>pom</packaging>/span>
<version>/span>1.0.0-SNAPSHOT</version>
<modules>/span>
<module>GameLogic</module>
<module>/span>DesktopApp</module>/span>
<module>/span>ConsoleApp</module>/span>
</modules>/span>
<properties>/span>
<maven.compiler.source>16</maven.compiler.source>/span>
<maven.compiler.target>/span>16</maven.compiler.target>/span>
</properties>
</project>/span>
請隨時詢問更多資訊!
uj5u.com熱心網友回復:
這可能是由于你將你的Java檔案夾標記為模塊檔案夾而不是源檔案夾造成的。轉到專案結構設定,洗掉以Java檔案夾命名的模塊。然后轉到模塊控制臺應用程式,將Java檔案夾標記為源檔案夾。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/310141.html
標籤:

