如何在intellij idea中通过maven集成编译scala源?
我正在学习抑扬顿挫 orm 并第一次使用 Maven 和 idea 。我预计 src
中的源代码将编译到 build
目录。但这并没有发生。如果我指定 sourceDirectory
和 outputDirectory
如 ${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>
我应该如何编译我的源代码?
I am learning circumflex orm and using maven with idea for the first time. I expected that my sources in src
will compile to build
directory. But it doesn't happen. And if I specify sourceDirectory
and outputDirectory
like ${basedir}/src
or ${project.basedir}/build
I get intellij idea's inspections that such folders doesn't exist (sic!)
<?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>
What should I do to compile my sources?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
谢谢 http://www.nearinfinity.com/blogs/bryan_weber/scala_and_maven_with_maven.html 很好的教程。
Thanks http://www.nearinfinity.com/blogs/bryan_weber/scala_and_maven_with_maven.html for good tutorial.
Maven 约定是编译后的类放入
target/classes
中。除非你有充分的理由以不同的方式去做,否则最好(而且痛苦更少)坚持惯例。The Maven convention is that the compiled classes are put into
target/classes
. Unless you have a very good reason to do it differently, it is better (and much less painful) to stick to the convention.