2

我有一个基于 Maven 的 Web 应用程序。通常当我们在 Eclipse 中保存一个类时,它会被编译并保存在目标文件夹中的位置,如 \my_project\src-java\target\classes\com\st\modulename\controller\HomeController.class。

但是在这个 Maven Web 应用程序中它没有发生。我必须手动运行 mvn install 以便编译类并反映在位置 \my_project\src-java\target\classes\com\st\modulename\controller\HomeController.class 中。

我已经在其他一些 maven 应用程序中完成了这项工作,它按预期工作,但在这种情况下不是。在这种情况下可能是什么问题?

这是 pom.xml

    <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/maven-v4_0_0.xsd">

    <properties>

        <!-- convenience to define GWT version in one place -->
        <spring-framework-security>3.1.0.RELEASE</spring-framework-security>
        <!-- tell the compiler we can use 1.5 -->
        <maven.compiler.source>1.6</maven.compiler.source>
        <maven.compiler.target>1.6</maven.compiler.target>

        <logback>0.9.24</logback>

        <org.springframework.version>3.1.0.RELEASE</org.springframework.version>
        <org.hibernate.version>3.5.1-Final</org.hibernate.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>net.sourceforge.saxon</groupId>
            <artifactId>saxon</artifactId>
            <version>9.2.1.2j</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-jsp</artifactId>
            <version>2.2.2</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>jcl-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>com.springsource.org.apache.commons.fileupload</artifactId>
            <version>1.2.0</version>
        </dependency>
        <dependency>
            <groupId>javassist</groupId>
            <artifactId>javassist</artifactId>
            <version>3.4.GA</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <version>${org.springframework.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>spring-aop</artifactId>
                    <groupId>org.springframework</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${spring-framework-security}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-asm</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-aop</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${spring-framework-security}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-tx</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-asm</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-aop</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-expression</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>2.0</version>
        </dependency>
        <!-- <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> 
            <version>1.5.8</version> </dependency> -->
        <!-- <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> 
            <version>1.5.8</version> </dependency> <dependency> <groupId>org.slf4j</groupId> 
            <artifactId>log4j-over-slf4j</artifactId> <version>1.6.0</version> </dependency> -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>${logback}</version>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback}</version>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-access</artifactId>
            <version>${logback}</version>
        </dependency>
        <!-- <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-ext</artifactId> 
            <version>1.6.0</version> </dependency> -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
        </dependency>
        <dependency>
            <groupId>jdom</groupId>
            <artifactId>jdom</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>jaxen</groupId>
            <artifactId>jaxen</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.ws.commons.schema</groupId>
            <artifactId>XmlSchema</artifactId>
            <version>1.4.3</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.1.13</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.7</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>learningPlatform</finalName>
        <plugins>

            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <webResources>
                        <resource>
                            <directory>src\main\resources</directory>
                            <excludes>
                                <exclude>**/application.properties</exclude>
                                <exclude>**/course_content.xml</exclude>
                                <exclude>**/logback.xml</exclude>
                                <exclude>**/policies/**</exclude>
                            </excludes>
                        </resource>
                    </webResources>
                    <manifest>
                        <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                    </manifest>
                    <archive>
                        <addMavenDescriptor>false</addMavenDescriptor>
                        <manifestEntries>
                            <Specification-Title>${project.name}</Specification-Title>
                            <Specification-Version>${project.version}</Specification-Version>
                            <Implementation-Version>${BUILD_NUMBER}</Implementation-Version>
                            <Build-Id>${BUILD_ID}</Build-Id>
                            <SVN_Version>${SVN_REVISION}</SVN_Version>

                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>warCopy</id>
                        <phase>package</phase>
                        <configuration>
                            <tasks>
                                <copy file="${basedir}/target/learningPlatform.war"
                                    toFile="D:/Flashcards/eclipse/vfabric-tc-server-developer-2.7.2.RELEASE/my_project/webapps/learningPlatform.war" />
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>yuicompressor-maven-plugin</artifactId>
                <version>1.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compress</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <nosuffix>true</nosuffix>
                    <excludes>
                        <!-- List of js files already minified -->
                        <exclude>**/*.min.js</exclude>
                        <exclude>**/jquery.js</exclude>
                        <exclude>**/jquery.jtemplates.js</exclude>
                        <exclude>**/swfobject.js</exclude>
                        <exclude>**/tiny_mce.js</exclude>
                        <exclude>**/tiny_mce_popup.js</exclude>
                        <exclude>**/jquery.tinymce.js</exclude>
                        <exclude>**/editor_template.js</exclude>
                        <exclude>**/editor_plugin.js</exclude>
                        <!-- List of js soruce files that are not required minifying -->
                        <exclude>**/editor_template_src.js</exclude>
                        <exclude>**/editor_plugin_src.js</exclude>
                        <!-- <exclude>**/tiny_mce_src.js</exclude> -->
                        <exclude>**/sparkpad.js</exclude>
                        <exclude>**/stepcarousel.js</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.zeroturnaround</groupId>
                <artifactId>jrebel-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-rebel-xml</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

        </plugins>

    </build>
    <repositories>

        <repository>
            <id>epseelon-repository</id>
            <url>http://m2repo.epseelon.org/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>

        <pluginRepository>
            <id>epseelon-repository</id>
            <url>http://m2repo.epseelon.org/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

</project>
4

0 回答 0