Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/393.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将Clojure添加到Java项目时出现问题_Java_Maven_Clojure - Fatal编程技术网

将Clojure添加到Java项目时出现问题

将Clojure添加到Java项目时出现问题,java,maven,clojure,Java,Maven,Clojure,我正在从事一个Java项目,它使用Maven来构建它。我正在开发的一些功能在Java中相当麻烦,但在Clojure中却非常简单,因此我想在Clojure中实现它,并让Java无缝地使用生成的类 下面是我需要通过的单元测试(src/test/java/com/foo/weather/DataProcessorTest.java): 我在pom.xml中添加了以下内容以构建Clojure代码: <project> <!-- lots of stuff omitted --&g

我正在从事一个Java项目,它使用Maven来构建它。我正在开发的一些功能在Java中相当麻烦,但在Clojure中却非常简单,因此我想在Clojure中实现它,并让Java无缝地使用生成的类

下面是我需要通过的单元测试(src/test/java/com/foo/weather/DataProcessorTest.java):

我在pom.xml中添加了以下内容以构建Clojure代码:

<project>
   <!-- lots of stuff omitted -->
   <build>
      <plugins>
         <!-- ... -->
         <plugin>
            <groupId>com.theoryinpractise</groupId>
            <artifactId>clojure-maven-plugin</artifactId>
            <version>1.3.6</version>
            <executions>
               <execution>
                 <id>compile</id>
                 <phase>compile</phase>
                 <goals>
                   <goal>compile</goal>
                 </goals>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
   <repositories>
      <!-- ... -->
      <repository>
         <id>clojure-releases</id>
         <url>http://build.clojure.org/releases</url>
       </repository>
   </repositories>
   <dependencies>
      <!-- ... -->
      <dependency>
         <groupId>org.clojure</groupId>
         <artifactId>clojure</artifactId>
         <version>1.2.1</version>
       </dependency>
   </dependencies>
</project>

理论与实践
clojure maven插件
1.3.6
编译
编译
编译
clojure释放
http://build.clojure.org/releases
org.clojure
clojure
1.2.1
然而,当试图运行我的单元测试时,编译器抱怨“找不到符号变量DataProcessor”,因此我的Clojure代码似乎没有被正确编译

我注意到的一件事是,我的src/main/clojure目录似乎没有被当作IDE(IntelliJ)中的源目录。我在项目视图中右键单击src/main/clojure并选择“将目录标记为>源根目录”,但在重新导入Maven依赖项(即Eclipse中的“更新依赖项”)后,该目录不再标记为源根目录

这让我相信我的问题在于我的Maven配置


有人能帮忙吗?

我在pom.xml中使用了以下内容,似乎很有效:

        <plugin>
            <groupId>com.theoryinpractise</groupId>
            <artifactId>clojure-maven-plugin</artifactId>
            <version>1.3.8</version>

            <executions>
                <!-- ... -->
                <execution>
                    <id>test-clojure</id>
                    <phase>test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>

            <configuration>
                <sourceDirectories>
                    <sourceDirectory>src/main/clojure</sourceDirectory>
                </sourceDirectories>
                <testSourceDirectories>
                    <testSourceDirectory>src/test/clojure</testSourceDirectory>
                </testSourceDirectories>
            </configuration>
        </plugin>

理论与实践

这似乎对我不起作用;我的JUnit测试仍然没有看到Clojure生成的类。事实上,这是我思考如何做到这一点的起点使用Maven的Java+Clojure项目的另一个选项是
<project>
   <!-- lots of stuff omitted -->
   <build>
      <plugins>
         <!-- ... -->
         <plugin>
            <groupId>com.theoryinpractise</groupId>
            <artifactId>clojure-maven-plugin</artifactId>
            <version>1.3.6</version>
            <executions>
               <execution>
                 <id>compile</id>
                 <phase>compile</phase>
                 <goals>
                   <goal>compile</goal>
                 </goals>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
   <repositories>
      <!-- ... -->
      <repository>
         <id>clojure-releases</id>
         <url>http://build.clojure.org/releases</url>
       </repository>
   </repositories>
   <dependencies>
      <!-- ... -->
      <dependency>
         <groupId>org.clojure</groupId>
         <artifactId>clojure</artifactId>
         <version>1.2.1</version>
       </dependency>
   </dependencies>
</project>
        <plugin>
            <groupId>com.theoryinpractise</groupId>
            <artifactId>clojure-maven-plugin</artifactId>
            <version>1.3.8</version>

            <executions>
                <!-- ... -->
                <execution>
                    <id>test-clojure</id>
                    <phase>test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>

            <configuration>
                <sourceDirectories>
                    <sourceDirectory>src/main/clojure</sourceDirectory>
                </sourceDirectories>
                <testSourceDirectories>
                    <testSourceDirectory>src/test/clojure</testSourceDirectory>
                </testSourceDirectories>
            </configuration>
        </plugin>