3

我正在学习circumflex orm并第一次使用带有想法的maven。我希望我的源代码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>

我应该怎么做才能编译我的源代码?

4

2 回答 2

3
<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的好教程。

于 2010-07-27T11:03:58.233 回答
2

Maven 约定是将编译后的类放入target/classes. 除非您有充分的理由采取不同的做法,否则最好(而且痛苦更少)坚持惯例。

于 2010-07-27T07:54:55.833 回答