intellij tomcat的“复制资源"花费太多时间 [英] intellij tomcat "copying resources" takes too much time

查看:119
本文介绍了intellij tomcat的“复制资源"花费太多时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JSF构建一个基本的Web应用程序,并使用IntelliJ IDEA构建spring.因此,我关注了这篇帖子使用tomcat配置IDEA.但是,当我运行该应用程序时,要花费太多时间来构建coping resources.(例如1/2个小时),而当我进行更改时,则需要花费更长的时间.最奇怪的是,构建之后,target文件夹中有〜2GB的文件.并将相同的类文件夹递归复制到其中.这意味着target\classes\classes\artifacts\java_test_war_exploded\WEB-INF\classes\target\classes\target\classes\target\m2e-wtp\web-resources\META-INF\maven\java_test\...等.就像无限!

I'm building a basic web app using JSF and spring using IntelliJ IDEA. So I followed this post to config the IDEA with tomcat. But when I run the app, it takes too much time to build saying coping resources.(like 1/2 an hour) And when I make a change it takes much longer time. Strangest thing is, after the build, there are ~2GB files inside the target folder. And the same classes folders are recursively copied in to it. which means target\classes\classes\artifacts\java_test_war_exploded\WEB-INF\classes\target\classes\target\classes\target\m2e-wtp\web-resources\META-INF\maven\java_test\...etc. This goes to like infinity!

这是什么问题?请有人帮忙! (对不起,我的英语)

What is the problem here? Please someone help! (sorry for my English)

<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>java_test</groupId>
    <artifactId>java_test</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>

        <!-- Spring -->
        <spring-framework.version>4.0.3.RELEASE</spring-framework.version>
        <aspectj.version>1.7.4</aspectj.version>

        <!-- Hibernate / JPA -->
        <hibernate.version>4.3.5.Final</hibernate.version>

        <!-- JSF Version -->
        <jsf.version>2.2.10</jsf.version>


    </properties>

    <dependencies>
        <!-- Spring and Transactions -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>
        <!-- @Inject -->
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
        </dependency>
        <!-- AspectJ -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>${aspectj.version}</version>
        </dependency>
        <!-- Spring ORM support -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${spring-framework.version}</version>
        </dependency>

        <!-- Hibernate -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.version}</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.9</version>
        </dependency>
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.4</version>
        </dependency>

        <!-- JSF Dependencies -->
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>${jsf.version}</version>
        </dependency>

        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>${jsf.version}</version>
        </dependency>


        <!-- http://repo1.maven.org/maven -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
        </dependency>

        <dependency>
            <groupId>com.sun.el</groupId>
            <artifactId>el-ri</artifactId>
            <version>1.0</version>
        </dependency>

        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>src</sourceDirectory>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.1</version>
                <configuration>
                    <warSourceDirectory>WebContent</warSourceDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

推荐答案

我已经遇到了这个问题.首先,检查项目文件夹的大小.如果太大而又不正常(我的目标文件夹超过〜2 GB),我们将遇到同样的问题! 导致此问题的我的错误是,在intellij的想法中,我在项目开始时就重构了很多软件包,并更改了文件夹的方向.我的IDE感到困惑,并在每个文件夹中创建了许多相同的文件夹,并继续进行了很多次!就像在镜子前拍照一样!您的照片会发生什么?它会无限重复. 我的解决方案:与上一个相同,再次创建我的项目.但要小心,不要重构! 就是这个!

I have faced this problem. At first check your project folder's size. If it is too large and it is not normal (my target folder was more than ~ 2 GB) , we have a same problem! My mistake which caused this problem was that in intellij idea, I had refactored so many packages and changed folder's directions so many at the beginning of my project. My IDE confused and made a lot of same folders in each folder and continued it many many times! Like taking selfie in front of a mirror! what will happen to your pic? it will repeat infinitely. my solution: create my project again as same as the previous one. but by taking care and not refactoring! Just this!

这篇关于intellij tomcat的“复制资源"花费太多时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆