scala之如何通过intellij idea中的maven集成编译scala源代码

freeliver54 阅读:18 2024-12-31 21:38:35 评论:0

我正在学习 circumflex orm 并第一次将 maven 与 idea 一起使用。我希望我在 src 中的源代码将编译到 build 目录。但它不会发生。如果我指定 sourceDirectoryoutputDirectory${basedir}/src${project.basedir}/build 我得到 intellij idea 的检查,发现此类文件夹不存在(原文如此!)

<?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"> 
    <modelVersion>4.0.0</modelVersion> 
 
    <groupId>C2Probe</groupId> 
    <artifactId>C2Probe</artifactId> 
    <version>1.0</version> 
 
    <build> 
        <sourceDirectory>src</sourceDirectory> 
        <outputDirectory>build</outputDirectory> 
 
        <plugins> 
            <plugin> 
                <groupId>ru.circumflex</groupId> 
                <artifactId>maven-cx-plugin</artifactId> 
                <version>${cx.version}</version> 
                <executions> 
                    <execution> 
                        <id>configure</id> 
                        <phase>compile</phase> 
                        <goals> 
                            <goal>cfg</goal> 
                        </goals> 
                    </execution> 
                </executions> 
            </plugin> 
        </plugins> 
    </build> 
    <properties> 
        <cx.version>1.1</cx.version> 
        <orm.connection.driver>org.postgresql.Driver</orm.connection.driver> 
        <orm.connection.url>jdbc:postgresql:mydb</orm.connection.url> 
        <orm.connection.username>myuser</orm.connection.username> 
        <orm.connection.password>mypass</orm.connection.password> 
    </properties> 
    <dependencies> 
        <dependency> 
            <groupId>ru.circumflex</groupId> 
            <artifactId>circumflex-orm</artifactId> 
            <version>${cx.version}</version> 
        </dependency> 
    </dependencies> 
</project> 

我应该如何编译我的源代码?

请您参考如下方法:

<build> 
    <sourceDirectory>src/main/scala</sourceDirectory> 
 
        <plugins> 
            <plugin> 
                <groupId>org.scala-tools</groupId> 
                <artifactId>maven-scala-plugin</artifactId> 
                <version>2.4</version> 
                <executions> 
                    <execution> 
                        <goals> 
                            <goal>compile</goal> 
                        </goals> 
                    </execution> 
                </executions> 
                <configuration> 
                    <mainClass>greet.Main</mainClass> 
                </configuration> 
            </plugin> 
        </plugins> 
</build> 

谢谢 http://www.nearinfinity.com/blogs/bryan_weber/scala_and_maven_with_maven.html好的教程。


标签:Maven
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

关注我们

一个IT知识分享的公众号