Maven的Pom文件 ( Eclipse中创建Maven工程, 使用注意点,DevOps相关)

xiaoxiao2021-02-27  227

■POM Eclipse 使用注意点 

  修改POM之后

 step1:右键点击工程,Maven,プロジェクトの更新 (project 更新)

    step2:点击 【プロジェクト】(project )⇒【すべてビルド】(build all)

    按照以上操作,修改POM文件之后,

    由于缺少jar包之类的编译错误,可以立即在 eclipse 中 显示出来。

 

■Eclipse中,创建Maven工程

https://blog.csdn.net/userzou/article/details/82895593

要选择 【skip archetype selection】

 同时,下面的那个选项也要选中

===

===

 

■POM --DevOps

https://blog.csdn.net/sxzlc/article/details/107145850

 

■POM --ソース

<project xmlns="http://maven.apache.org/POM/4.0.0" 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"> <modelVersion>4.0.0</modelVersion> <!-- 基本配置 --> <groupId>lms</groupId> <artifactId>lms</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <properties> <org.apache.struts.version>2.5.5</org.apache.struts.version> <org.hibernate.version>5.0.1.Final</org.hibernate.version> <org.springframework.version>4.3.4.RELEASE</org.springframework.version> </properties> <dependencies> <!-- struts包 --> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core</artifactId> <version>${org.apache.struts.version}</version> </dependency> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-spring-plugin</artifactId> <version>${org.apache.struts.version}</version> </dependency> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-dojo-plugin</artifactId> <version>2.3.32</version> </dependency> <!-- Hibernate包 --> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>${org.hibernate.version}</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-dbcp2</artifactId> <version>2.1.1</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.38</version> </dependency> <!-- Spring包 --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>${org.springframework.version}</version> </dependency> <!-- javassist --> <dependency> <groupId>org.javassist</groupId> <artifactId>javassist</artifactId> <version>3.20.0-GA</version> </dependency> <!-- 依赖配置 --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> </dependencies> <profiles> <profile> <!-- 本地开发环境 --> <id>dev</id> <properties> <package.environment>dev</package.environment> </properties> <activation> <activeByDefault>true</activeByDefault> </activation> </profile> <profile> <!-- 测试环境 --> <id>test</id> <properties> <package.environment>test</package.environment> </properties> </profile> </profiles> <!-- 构建配置 --> <build> <finalName>lms</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> <compilerArgs> <arg>-verbose</arg> <arg>-Xlint:unchecked</arg> <arg>-Xlint:deprecation</arg> <arg>-extdirs</arg> <arg>${project.basedir}/src/main/webapp/WEB-INF/lib</arg> </compilerArgs> </configuration> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>3.0.0</version> <configuration> <warSourceDirectory>src/main/webapp</warSourceDirectory> <warSourceExcludes>WEB-INF/config/spring/dev/*.*,WEB-INF/config/spring/test/*.*</warSourceExcludes> <archive> <addMavenDescriptor>false</addMavenDescriptor> </archive> <webResources> <resource> <directory>src/main/webapp/WEB-INF/config/spring/${package.environment}</directory> <targetPath>WEB-INF/config/spring</targetPath> <filtering>true</filtering> </resource> </webResources> </configuration> </plugin> </plugins> </build> </project>

1.

 

2.

 

 

 

转载请注明原文地址: https://www.6miu.com/read-9082.html

最新回复(0)