Maven相当于eclipse“干净项目”

时间:2015-07-14 09:25:55

标签: linux eclipse maven build

我有一个多级maven项目,其中包括一个引用所有其他(也是maven)项目的主要模块:

<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>com.evercompliant</groupId>
<artifactId>PipelineMultiModule</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Pipeline Multi Module</name>
<description>Maven multi module project</description>
<url>http://maven.apache.org</url>


<properties>

    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>
<modules>
    <module>../AggregationHandler</module>
    <module>../CrawlerUtils</module>
    <module>../CrawlManager</module>
    <module>../CrawlerDevLibrary</module>
    <module>../DigestManager</module>
    <module>../GCrawler/GoogleCrawler</module>
    <module>../UrlService</module>
    <module>../WebPageCapture</module>
    <module>../WhoisParser</module>
    <module>../TextClassifier</module>
    <module>../scanpipelineservice</module>
</modules>

<dependencies>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.34</version>
    </dependency>
</dependencies>

为了在Windows上进行完整构建,我需要从eclipse执行maven clean和maven安装。 出于某种原因,如果我不在mvn clean和mvn install之间执行eclipse的“清理所有项目”,则工件不包含我的项目的二进制文件。 例如,为AggregationHandler项目创建的jar将包含其所有依赖项(例如CrawlerUtils),但不包括AggregationHandler本身的代码。 正如我所说,可以通过执行“清理所有项目”来修复它。

这是AggregationHandler项目的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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>AggregationHandler</artifactId>

<name>Aggregation Handler</name>
<dependencies>
    <dependency>
        <groupId>com.evercompliant</groupId>
        <artifactId>CrawlerUtils</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <scope>compile</scope>
    </dependency>
</dependencies>
<build>
    <sourceDirectory>src/main/java</sourceDirectory>
    <plugins>
        <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <id>default-jar</id>
                    <phase>package</phase>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>com.evercompliant.aggregationhandler.service.DoAction</mainClass>
                    </manifest>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>com.evercompliant.aggregationhandler.service.DoAction</mainClass>
                    </manifest>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
        </plugin>
    </plugins>
</build>

<parent>
    <groupId>com.evercompliant</groupId>
    <artifactId>PipelineMultiModule</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <relativePath>../PipelineMultiModule</relativePath>
</parent>

问题是,我现在需要在没有eclipse的linux环境下构建这个项目。我是否可以对pom.xml文件进行任何更改以解决此问题?

0 个答案:

没有答案