1.pom文件新增
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>3.0.1</version> <!-- 綁定source插件到Maven的生命周期,並在生命周期后執行綁定的source的goal --> <executions> <execution> <!-- 綁定source插件到Maven的生命周期 --> <phase>compile</phase> <!--在生命周期后執行綁定的source插件的goals --> <goals> <goal>jar-no-fork</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skip>false</skip> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build>
<distributionManagement> <repository> <id>deploy</id> <name>deploy</name> <url>http://192.168.43.91:8081/repository/</url> </repository> </distributionManagement>
2.maven配置文件中配置maven私服賬號密碼
<servers> <server> <id>deploy</id> <username>user_name</username> <password>user_pwd</password> </server> </servers>
3.打開命令終端,進入pom文件所在目錄,執行命令mvn deploy