【问题标题】:Maven Eclipse: How to include custom folder (with files) into the "target" folder on build?Maven Eclipse:如何在构建时将自定义文件夹(带有文件)包含到“目标”文件夹中?
【发布时间】:2019-01-27 11:19:48
【问题描述】:

我有一个 Eclipse-Maven 项目。在那个项目中,我创建了一个名为 installScripts 的自定义文件夹,并且有 3 个文件。
当我构建 pom.xml 文件时,我希望这个文件夹(及其内容)出现在我的 target 文件夹中。
以下是我的文件夹结构:

我的 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>
    <groupId>com.comcast.mongo</groupId>
    <artifactId>MongoRead</artifactId>
    <version>0.1</version>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-core_2.11</artifactId>
            <version>2.2.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-sql_2.11</artifactId>
            <version>2.2.0</version>
        </dependency>

        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>2.11.8</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.mongodb.spark</groupId>
            <artifactId>mongo-spark-connector_2.11</artifactId>
            <version>2.2.0</version>
        </dependency>
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>bson</artifactId>
            <version>2.3</version>
        </dependency>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc</artifactId>
            <version>7</version>
            <!--<scope>system</scope> <systemPath>${basedir}/ojdbc-7.jar</systemPath> -->
        </dependency>
        <dependency>
            <groupId>org.clojure</groupId>
            <artifactId>java.jdbc</artifactId>
            <version>0.7.0</version>
        </dependency>

    </dependencies>


    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
            </plugin>

            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2.1</version>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

【问题讨论】:

标签: java eclipse maven maven-3


【解决方案1】:

将已安装的脚本目录移动到资源并尝试。即在 src/main/resources 下

【讨论】:

  • 如果需要,使用 src/main/resources 文件夹中的子文件夹,例如 src/main/resources/installScripts
猜你喜欢
  • 2020-06-16
  • 2014-04-07
  • 1970-01-01
  • 2018-11-15
  • 1970-01-01
  • 2011-12-15
  • 2018-04-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多