【问题标题】:How to exclude source files using Clojure maven plugin?如何使用 Clojure maven 插件排除源文件?
【发布时间】:2014-03-19 14:25:35
【问题描述】:

我正在尝试使用 Maven 和 clojure-maven-plugin 将一些 Clojure 代码编译到一个 jar 中。

生成的 jar 包含源 *.clj 文件,我想从最终的 jar 中排除这些文件, 并且仅包含 AOT 编译文件

我的pom文件如下:

<?xml version="1.0" encoding="UTF-8"?>
<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">

    <artifactId>clojure-interop</artifactId>
    <groupId>com.testing.clojure</groupId>
    <version>1.0.0</version>

    <modelVersion>4.0.0</modelVersion>

    <packaging>jar</packaging>

    <build>
        <plugins>
            <plugin>
                <groupId>com.theoryinpractise</groupId>
                <artifactId>clojure-maven-plugin</artifactId>
                <version>1.3.13</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <id>compile-clojure</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>test-clojure</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>clojars</id>
            <url>http://clojars.org/repo/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.clojure</groupId>
            <artifactId>clojure</artifactId>
            <version>1.5.0</version>
        </dependency>
    </dependencies>

</project>

有人能指出正确的方向吗?

【问题讨论】:

    标签: java maven clojure


    【解决方案1】:

    可以使用 copiedNamespacescopyDeclaredNamespaceOnlycopyAllCompiledNamespaces 配置属性的组合来配置 clojure-maven-plugin 从 jar 中排除一些源文件。为了从 jar 中排除所有源文件,请使用:

      <plugin>
        <groupId>com.theoryinpractise</groupId>
        <artifactId>clojure-maven-plugin</artifactId>
        <version>1.3.15</version>
        <extensions>true</extensions>
        <configuration>
          <copiedNamespaces>
            <copiedNamespace>!.*</copiedNamespace>
          </copiedNamespaces>
        </configuration>
       ......
      </plugin>
    

    更多信息请见here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-10-04
      • 1970-01-01
      • 2013-10-03
      • 2015-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多