传统java web改造为maven

重点在iml文件和pom文件很容易忽略里面的配置,自动生成iml文件启动会无法加载出项目

项目名称iml文件生成

<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
  <***ponent name="FacetManager">
    <facet type="web" name="Web">
      <configuration>
        <descriptors>
          <deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml" />
        </descriptors>
        <webroots>
          <root url="file://$MODULE_DIR$/web" relative="/" />
        </webroots>
        <sourceRoots>
          <root url="file://$MODULE_DIR$/src/main/java" />
          <root url="file://$MODULE_DIR$/src/main/resources" />
        </sourceRoots>
      </configuration>
    </facet>
    <facet type="Spring" name="Spring">
      <configuration />
    </facet>
  </***ponent>
  <***ponent name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
    <output url="file://$MODULE_DIR$/target/classes" />
    <output-test url="file://$MODULE_DIR$/target/test-classes" />
    <content url="file://$MODULE_DIR$">
      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
      <excludeFolder url="file://$MODULE_DIR$/target" />
    </content>
    <orderEntry type="inheritedJdk" />
    <orderEntry type="sourceFolder" forTests="false" />
    <orderEntry type="library" name="Maven: ***mons-fileupload:***mons-fileupload:1.2" level="project" />
    <orderEntry type="library" name="Maven: ***mons-io:***mons-io:1.4" level="project" />
    <orderEntry type="library" name="Maven: ***mons-lang:***mons-lang:2.4" level="project" />
    <orderEntry type="library" name="Maven: ***.alibaba:fastjson:1.1.33" level="project" />
    <orderEntry type="library" name="Maven: org.apache.http***ponents:httpclient:4.5.4" level="project" />
    <orderEntry type="library" name="Maven: org.apache.http***ponents:httpcore:4.4.7" level="project" />
    <orderEntry type="library" name="Maven: org.apache.http***ponents:httpmime:4.5.4" level="project" />
    <orderEntry type="library" name="Maven: log4j:log4j:1.2.17" level="project" />
    <orderEntry type="library" name="Maven: org.apache.***mons:***mons-imaging:1.0-alpha2" level="project" />
    <orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:3.0.1" level="project" />
    <orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
  </***ponent>
</module>

WebContent对应src\main\webapp

<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>***.xxxxx</groupId>
	<artifactId>xxxxx</artifactId>
    <version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>

    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

	<dependencies>
		<dependency>
            <groupId>***mons-fileupload</groupId>
            <artifactId>***mons-fileupload</artifactId>
            <version>1.2</version>
        </dependency>

        <dependency>
            <groupId>***mons-io</groupId>
            <artifactId>***mons-io</artifactId>
            <version>1.4</version>
        </dependency>

        <dependency>
            <groupId>***mons-lang</groupId>
            <artifactId>***mons-lang</artifactId>
            <version>2.4</version>
        </dependency>

        <dependency>
            <groupId>***.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.1.33</version>
        </dependency>

        <dependency>
            <groupId>org.apache.http***ponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.4</version>
        </dependency>

        <dependency>
            <groupId>org.apache.http***ponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>4.4.7</version>
        </dependency>

        <dependency>
            <groupId>org.apache.http***ponents</groupId>
            <artifactId>httpmime</artifactId>
            <version>4.5.4</version>
        </dependency>

<!--        <dependency>-->
<!--            <groupId>log4j</groupId>-->
<!--            <artifactId>log4j</artifactId>-->
<!--            <version>1.2.15</version>-->
<!--        </dependency>-->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

        <dependency>
            <groupId>org.apache.***mons</groupId>
            <artifactId>***mons-imaging</artifactId>
            <version>1.0-alpha2</version>
        </dependency>
		
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
        </dependency>

        <!-- 单元测试支持 -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>

	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<version>3.2.2</version>
                <configuration>
                    <warSourceDirectory>web</warSourceDirectory>
                    <warName>image</warName>
                </configuration>
			</plugin>
		</plugins>
	</build>

</project>

 

转载请说明出处内容投诉
CSS教程_站长资源网 » 传统java web改造为maven

发表评论

欢迎 访客 发表评论

一个令你着迷的主题!

查看演示 官网购买