Enabling the macro-paradise Scala compiler plugin in Maven projects

大城市里の小女人 提交于 2019-11-27 15:07:43

问题


I have the ordinary scala-2.10 macros working in a maven project just by including the scala-reflect.jar library as a dependency in the pom, but what do I need to turn on macro-paradise? I am using scala-2.10 and scala-maven-plugin-3.1.5.


回答1:


Looks like I got it to work with the following additions to the pom.xml

 <repositories>
   ...
   <repository>
     <id>oss.sonatype.org</id>
      <name>sonatype sapshots</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </repository>
   ...
  </repositories>

and

  <plugins>
    ...
    <plugin>
      ... scala-maven-plugin identification...
      <configuration>
        ...
        <compilerPlugins>
          <compilerPlugin>
            <groupId>org.scala-lang.plugins</groupId>
            <artifactId>macro-paradise_2.10.2</artifactId>
            <version>2.0.0-SNAPSHOT</version>
          </compilerPlugin>
        </compilerPlugins>
        ...
      </configuration>
      ...
    </plugin>
    ...
  </plugins>



回答2:


for me although with the above relative clear description, I still can't figure out where this should be placed. and then this link helped: example config

and I always had trouble fill in the correct groupId and arti-fact Id for this. as it disagrees in the above and scala-lang ref, until I opened oss repo and figured out the listed config there.



来源:https://stackoverflow.com/questions/19086241/enabling-the-macro-paradise-scala-compiler-plugin-in-maven-projects

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!