2010-07-27 3 views
3

나는 circumflex orm을 배우고 처음으로 아이디어가있는 maven을 사용하고 있습니다. 나는 src에 내 소스가 build 디렉토리로 컴파일 될 것으로 예상했다. 그러나 그것은 일어나지 않습니다. 내가 ${basedir}/src 또는 ${project.basedir}/build 같은 sourceDirectoryoutputDirectory를 지정하는 경우, 그리고 같은 폴더가 존재하지 않음을 인 IntelliJ 아이디어의 검사를받을 (원문를!)intellij 아이디어에서 maven 통합을 통해 스칼라 소스를 컴파일하는 방법은 무엇입니까?

<?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> 

내 소스를 컴파일하려면 어떻게해야합니까?

답변

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.

+2

이제 [scala-maven-plugin] (https://github.com/davidB/scala-maven-plugin)을 사용해야합니다. – schmmd

2

Maven 규칙은 컴파일 된 클래스가 target/classes입니다. 다르게 할 이유가 없다면 대회에 충실하는 것이 더 낫습니다.

+0

스칼라에서 프로그래밍하는 것이 좋은 이유입니까 아니면 src/main/java에 scala soursces를 넣어야합니까? 그리고 내가 "sourceDirectory"및 "outputDirectory"태그를 제거해야하는 것보다이 규칙을 따르는 경우? (나는 그것을했고 "컴파일 할 것이 없다 - 모든 수업이 최신 상태"라는 말을 다시 듣는다). – Jeriho

+0

@Jeriho, 나는 Scala에 대한 경험이 없지만 AFAIK는 Scala 소스에 대해 다른 컴파일러가 필요하기 때문에'src/main/scala'에 넣을 것입니다. 그 소스 디렉토리를 Maven에 명시 적으로 설정해야 할 수도 있습니다. –

관련 문제