Przeglądaj źródła

feat:修改pom文件

zhaohaipeng 3 tygodni temu
rodzic
commit
a1224c6455
1 zmienionych plików z 36 dodań i 17 usunięć
  1. 36 17
      pom.xml

+ 36 - 17
pom.xml

@@ -33,6 +33,8 @@
         <maven.compiler.target>${java.version}</maven.compiler.target>
         <emr.version>2.0.0</emr.version>
         <odps.version>0.28.4-public</odps.version>
+        <!-- 新增:指定 Scala 插件版本(适配 2.11) -->
+        <scala-maven-plugin.version>4.4.0</scala-maven-plugin.version>
     </properties>
 
     <groupId>com.aliyun.odps</groupId>
@@ -52,11 +54,11 @@
             <artifactId>hanlp</artifactId>
             <version>portable-1.8.2</version>
         </dependency>
-<!--        <dependency>-->
-<!--            <groupId>com.medallia.word2vec</groupId>-->
-<!--            <artifactId>word2vec</artifactId>-->
-<!--            <version>0.1.42</version>-->
-<!--        </dependency>-->
+        <!--        <dependency>-->
+        <!--            <groupId>com.medallia.word2vec</groupId>-->
+        <!--            <artifactId>word2vec</artifactId>-->
+        <!--            <version>0.1.42</version>-->
+        <!--        </dependency>-->
 
         <dependency>
             <groupId>org.xm</groupId>
@@ -170,7 +172,6 @@
             <version>3.3.0</version>
         </dependency>
 
-
         <dependency>
             <groupId>org.projectlombok</groupId>
             <artifactId>lombok</artifactId>
@@ -189,6 +190,10 @@
     </dependencies>
 
     <build>
+        <!-- 新增:指定源码目录(确保 scala 目录被识别) -->
+        <sourceDirectory>src/main/scala</sourceDirectory>
+        <testSourceDirectory>src/test/scala</testSourceDirectory>
+
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
@@ -209,25 +214,39 @@
                 </configuration>
             </plugin>
 
+            <!-- 关键修改:替换为新版 Scala 编译插件 -->
             <plugin>
-                <groupId>org.scala-tools</groupId>
-                <artifactId>maven-scala-plugin</artifactId>
-                <version>2.15.2</version>
+                <groupId>net.alchim31.maven</groupId>
+                <artifactId>scala-maven-plugin</artifactId>
+                <version>${scala-maven-plugin.version}</version>
                 <executions>
                     <execution>
+                        <id>scala-compile-first</id>
+                        <phase>process-resources</phase>
                         <goals>
+                            <goal>add-source</goal> <!-- 关键:添加源码目录 -->
                             <goal>compile</goal>
+                        </goals>
+                        <configuration>
+                            <scalaVersion>${scala.version}</scalaVersion>
+                            <compileJavaWithJavac>true</compileJavaWithJavac> <!-- 编译 Java 文件 -->
+                            <includes>
+                                <include>**/*.scala</include>
+                                <include>**/*.java</include>
+                            </includes>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>scala-test-compile</id>
+                        <phase>process-test-resources</phase>
+                        <goals>
                             <goal>testCompile</goal>
                         </goals>
+                        <configuration>
+                            <scalaVersion>${scala.version}</scalaVersion>
+                        </configuration>
                     </execution>
                 </executions>
-                <configuration>
-                    <includes>
-                        <include>**/*.scala</include>
-                        <include>**/*.java</include>
-                    </includes>
-                    <scalaVersion>${scala.version}</scalaVersion>
-                </configuration>
             </plugin>
 
             <plugin>
@@ -250,4 +269,4 @@
         </plugins>
     </build>
 
-</project>
+</project>