Can I use Frege in my project via a maven dependency?

293 views Asked by At

If Frege had a POM and was uploaded to maven central or bintray, I could easily use it as a maven dependency in maven, gradle, buildr, and via grapes. I couldn't find it, though. Is there any such thing? I would not require a full maven plugin.

1

There are 1 answers

2
Marimuthu Madasamy On BEST ANSWER

There is a Maven plugin for Frege here: https://github.com/talios/frege-maven-plugin but I am not sure how much it is up to date with current Frege version.

Further as far as I know, the Frege jar is still not in any central repository so you would need to have it in some local repository to use that plugin. For example, https://github.com/talios/frege-testing/blob/master/pom.xml

You can also invoke the Frege compiler through Ant in Maven (not the best way but still an option):

  <plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.7</version>
    <executions>
      <execution>
        <phase>compile</phase>
        <configuration>
          <target>
            <property name="compile_classpath" refid="maven.compile.classpath" />
            <property name="outputDir"
              value="${project.build.outputDirectory}" />
            <property name="sourceDir" value="src/main/frege" />
            <property name="fregec" value="${frege:frege:jar}" />
            <exec executable="java" failonerror="true">
              <arg value="-Xss1m" />
              <arg value="-Dfrege.javac=javac" />
              <arg value="-classpath" />
              <arg value="${compile_classpath}" />
              <arg value="frege.compiler.Main" />
              <arg value="-d" />
              <arg path="${outputDir}" />
              <arg value="${sourceDir}/helloworld/Foo.fr" />
              <arg value="${sourceDir}/helloworld/bar.fr" />
            </exec>
          </target>
        </configuration>
        <goals>
          <goal>run</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

Here also frege:frege:jar refers to the Frege jar in local repository. If you have any Java dependency from your Frege code or other way around, it is better to have those as separate modules (a Java module and a Frege module) so that the compilation order (Java and Frege compilation) is determined by the order the modules are built.