[maven-scala-plugin] 01/03: Imported Upstream version 2.15.2
Andreas Tille
tille at debian.org
Thu Jan 28 18:28:38 UTC 2016
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository maven-scala-plugin.
commit 48d4d4a4f57fa00a3216850b591dc8fe4f3e0afd
Author: Andreas Tille <tille at debian.org>
Date: Thu Jan 28 17:10:16 2016 +0100
Imported Upstream version 2.15.2
---
.gitignore | 44 ++
.pom.yml | 3 +
pom.xml | 437 +++++++++++
src/changes/changes.xml | 169 ++++
src/it/27_scalac-plugin/invoker.properties | 1 +
src/it/27_scalac-plugin/pom.xml | 82 ++
.../src/it/plugin-test/invoker.properties | 1 +
src/it/27_scalac-plugin/src/it/plugin-test/pom.xml | 72 ++
.../it/plugin-test/src/main/scala/TestWidget.scala | 7 +
.../src/it/plugin-test/validate.groovy | 12 +
.../src/main/resources/scalac-plugin.xml | 4 +
.../src/main/scala/TestPlugin.scala | 47 ++
.../27_scaladocOnMultiModules/invoker.properties | 1 +
src/it/27_scaladocOnMultiModules/m1/pom.xml | 20 +
.../m1/src/main/scala/p1/MyClass.scala | 8 +
src/it/27_scaladocOnMultiModules/m2/pom.xml | 20 +
.../m2/src/main/scala/p2/MyClass.scala | 8 +
src/it/27_scaladocOnMultiModules/pom.xml | 72 ++
src/it/27_scaladocOnMultiModules/validate.groovy | 11 +
.../27_vscaladocOnMultiModules/invoker.properties | 1 +
src/it/27_vscaladocOnMultiModules/m1/pom.xml | 20 +
.../m1/src/main/scala/p1/MyClass.scala | 8 +
src/it/27_vscaladocOnMultiModules/m2/pom.xml | 20 +
.../m2/src/main/scala/p2/MyClass.scala | 8 +
src/it/27_vscaladocOnMultiModules/pom.xml | 75 ++
src/it/27_vscaladocOnMultiModules/validate.groovy | 21 +
src/it/includesExcludes/invoker.properties | 1 +
src/it/includesExcludes/pom.xml | 77 ++
.../includesExcludes/src/main/java/TestClass.java | 4 +
.../includesExcludes/src/main/scala/MyClass.scala | 6 +
src/it/includesExcludes/src/main/scala/bad.scala | 3 +
src/it/includesExcludes/validate.groovy | 21 +
src/it/mismatchedScalaVersions/invoker.properties | 1 +
src/it/mismatchedScalaVersions/pom.xml | 85 ++
.../src/main/scala/ScalaClass.scala | 6 +
src/it/mismatchedScalaVersions/validate.groovy | 21 +
src/it/next_test-scalac/.scala_dependencies | 0
src/it/next_test-scalac/invoker.properties | 1 +
src/it/next_test-scalac/pom.xml | 50 ++
.../next_test-scalac/src/main/scala/MyClass.scala | 6 +
src/it/next_test-scalac/validate.groovy | 14 +
src/it/next_test-scalac/validate.groovy.save | 14 +
src/it/off-20101014_liftone/invoker.properties | 1 +
src/it/off-20101014_liftone/pom.xml | 117 +++
.../src/main/scala/bootstrap/liftweb/Boot.scala | 45 ++
.../src/main/scala/com/liftone/comet/.keep | 0
.../src/main/scala/com/liftone/model/.keep | 0
.../src/main/scala/com/liftone/model/User.scala | 35 +
.../src/main/scala/com/liftone/snippet/.keep | 0
.../scala/com/liftone/snippet/HelloWorld.scala | 6 +
.../src/main/scala/com/liftone/view/.keep | 0
.../src/main/webapp/WEB-INF/web.xml | 21 +
.../src/main/webapp/index.html | 5 +
.../src/test/scala/LiftConsole.scala | 15 +
.../src/test/scala/RunWebApp.scala | 28 +
.../src/test/scala/com/liftone/AppTest.scala | 29 +
src/it/settings.xml | 35 +
src/it/test1/invoker.properties | 1 +
src/it/test1/pom.xml | 60 ++
src/it/test1/src/main/java/TestClass.java | 4 +
src/it/test1/src/main/scala/MyClass.scala | 6 +
src/it/test1/validate.groovy | 21 +
src/it/testJavaAndScala/invoker.properties | 1 +
src/it/testJavaAndScala/pom.xml | 74 ++
.../testJavaAndScala/src/main/java/JavaClass.java | 6 +
.../src/main/java/JavaInterface.java | 4 +
.../src/main/scala/ScalaClass.scala | 6 +
src/it/testJavaAndScala/validate.groovy | 18 +
src/it/testLotsofJavaFiles/invoker.properties | 1 +
src/it/testLotsofJavaFiles/pom.xml | 90 +++
src/it/testLotsofJavaFiles/setup.groovy | 25 +
.../src/main/scala/ScalaClass.scala | 6 +
src/it/testLotsofJavaFiles/validate.groovy | 1 +
.../testLotsofJavaFilesNoFork/invoker.properties | 1 +
src/it/testLotsofJavaFilesNoFork/pom.xml | 97 +++
src/it/testLotsofJavaFilesNoFork/setup.groovy | 25 +
.../src/main/scala/ScalaClass.scala | 6 +
src/it/testLotsofJavaFilesNoFork/validate.groovy | 1 +
src/it/test_goal_doc/invoker.properties | 1 +
src/it/test_goal_doc/pom.xml | 65 ++
src/it/test_goal_doc/src/main/java/TestClass.java | 4 +
src/it/test_goal_doc/src/main/scala/MyClass.scala | 6 +
src/it/test_goal_doc/validate.groovy | 21 +
src/it/test_goal_site/invoker.properties | 1 +
src/it/test_goal_site/pom.xml | 66 ++
src/it/test_goal_site/src/main/java/TestClass.java | 4 +
src/it/test_goal_site/src/main/scala/MyClass.scala | 6 +
src/it/test_goal_site/validate.groovy | 21 +
.../test_scaladoc2_onJavaScala/invoker.properties | 1 +
src/it/test_scaladoc2_onJavaScala/pom.xml | 131 ++++
.../src/main/java/HelloJava.java | 6 +
.../src/main/scala/HelloScala.scala | 6 +
src/it/test_scaladoc2_onJavaScala/validate.groovy | 15 +
src/it/test_script_hello/invoker.properties | 1 +
src/it/test_script_hello/pom.xml | 64 ++
src/it/test_script_hello/validate.groovy | 13 +
.../java/org_scala_tools_maven/AddSourceMojo.java | 60 ++
.../java/org_scala_tools_maven/BasicArtifact.java | 27 +
src/main/java/org_scala_tools_maven/Launcher.java | 21 +
.../org_scala_tools_maven/ScalaCompileMojo.java | 75 ++
.../ScalaCompilerSupport.java | 218 ++++++
.../org_scala_tools_maven/ScalaConsoleMojo.java | 114 +++
.../ScalaContinuousCompileMojo.java | 207 +++++
.../ScalaContinuousTestMojo.java | 154 ++++
.../java/org_scala_tools_maven/ScalaDocMojo.java | 460 +++++++++++
.../org_scala_tools_maven/ScalaGenJsonMojo.java | 303 ++++++++
.../java/org_scala_tools_maven/ScalaHelpMojo.java | 47 ++
.../org_scala_tools_maven/ScalaMojoSupport.java | 561 +++++++++++++
.../java/org_scala_tools_maven/ScalaRunMojo.java | 110 +++
.../org_scala_tools_maven/ScalaScriptMojo.java | 468 +++++++++++
.../ScalaSourceMojoSupport.java | 141 ++++
.../ScalaTestCompileMojo.java | 92 +++
.../java/org_scala_tools_maven/TychoUtilities.java | 114 +++
.../java/org_scala_tools_maven/VersionNumber.java | 76 ++
.../ScalaCSCompileAllMojo.java | 14 +
.../ScalaCSCompileMojo.java | 14 +
.../ScalaCSCompileSingleMojo.java | 14 +
.../org_scala_tools_maven_cs/ScalaCSInitMojo.java | 171 ++++
.../ScalaCSMojoSupport.java | 49 ++
.../ScalaCSRemoveMojo.java | 14 +
.../org_scala_tools_maven_cs/ScalaCSStopMojo.java | 14 +
.../org_scala_tools_maven_cs/ScalacsClient.java | 337 ++++++++
.../CheckScalaVersionVisitor.java | 68 ++
.../ScalaConstants.java | 10 +
.../ScalaDistroArtifactFilter.java | 24 +
.../StringUtil.java | 22 +
.../JavaMainCaller.java | 44 ++
.../JavaMainCallerByFork.java | 169 ++++
.../JavaMainCallerInProcess.java | 101 +++
.../JavaMainCallerSupport.java | 98 +++
.../MainHelper.java | 183 +++++
.../MainWithArgsInFile.java | 33 +
.../SpawnMonitor.java | 5 +
.../MavenProjectAdapter.java | 864 +++++++++++++++++++++
.../resources/announcements/announcement.md.vm | 134 ++++
.../scalacs.boot.properties | 22 +
src/site/site.xml | 50 ++
src/site/xdoc/articles.xml | 19 +
src/site/xdoc/example_cc.xml | 43 +
src/site/xdoc/example_cctest.xml | 78 ++
src/site/xdoc/example_compile.xml | 127 +++
src/site/xdoc/example_console.xml | 118 +++
src/site/xdoc/example_doc.xml | 148 ++++
src/site/xdoc/example_java.xml | 142 ++++
src/site/xdoc/example_run.xml | 64 ++
src/site/xdoc/example_scalac_plugins.xml | 108 +++
src/site/xdoc/example_script.xml | 170 ++++
src/site/xdoc/faq.xml | 72 ++
src/site/xdoc/index.xml | 24 +
src/site/xdoc/usage.xml | 110 +++
src/test/java/org_scala_tools_maven/MiscTest.java | 29 +
.../org_scala_tools_maven/VersionNumberTest.java | 37 +
152 files changed, 9696 insertions(+)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b5ae250
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,44 @@
+# use glob syntax.
+syntax: glob
+*.ser
+*.class
+*~
+*.bak
+*.off
+*.old
+
+# eclipse conf file
+.settings
+.classpath
+.project
+.manager
+
+# building
+target
+build
+null
+tmp*
+temp*
+dist
+test-output
+build.log
+pom.xml.releaseBackup
+release.properties
+TestJavaClass*.java
+interpolated-*.xml
+
+# other scm
+.svn
+.CVS
+.hg*
+
+# switch to regexp syntax.
+# syntax: regexp
+# ^\.pc/
+
+#SHITTY output not in target directory
+build.log
+
+/maven-scala-plugin.iml
+/maven-scala-plugin.ipr
+/maven-scala-plugin.iws
diff --git a/.pom.yml b/.pom.yml
new file mode 100644
index 0000000..480febc
--- /dev/null
+++ b/.pom.yml
@@ -0,0 +1,3 @@
+!!org.twdata.maven.yamlpom.SyncFile
+xml: {md5: 0A3D4478043E6109EBF09BCF64567077, syncBy: dwayne, timestamp: 1252510464000}
+yaml: {md5: D9E313DFD14D36093BD1A240855D735F, syncBy: dwayne, timestamp: 1252510464000}
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..08fe34d
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,437 @@
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>2.15.2</version>
+ <packaging>maven-plugin</packaging>
+
+ <name>maven-scala-plugin</name>
+ <url>http://scala-tools.org/mvnsites/${project.artifactId}</url>
+ <!--url>http://github.com/davidB/${project.artifactId}</url -->
+ <description>The maven-scala-plugin is used for compiling/testing/running/documenting scala code in maven.</description>
+ <inceptionYear>2010</inceptionYear>
+ <organization>
+ <name>Scala Tools</name>
+ <url>http://scala-tools.org/</url>
+ </organization>
+
+ <licenses>
+ <license>
+ <name>the Apache License, ASL Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+
+ <scm>
+ <connection>scm:git:git://github.com/davidB/maven-scala-plugin.git</connection>
+ <developerConnection>scm:git:git at github.com:davidB/${project.artifactId}.git</developerConnection>
+ <url>http://github.com/davidB/${project.artifactId}/</url>
+ </scm>
+
+ <issueManagement>
+ <system>github</system>
+ <url>http://github.com/davidB/maven-scala-plugin/issues#issue/</url>
+ </issueManagement>
+
+ <mailingLists>
+ <mailingList>
+ <name>maven-and-scala</name>
+ <archive>http://groups.google.com/group/maven-and-scala</archive>
+ <post>http://groups.google.com/group/maven-and-scala</post>
+ </mailingList>
+ </mailingLists>
+
+ <distributionManagement>
+ <repository>
+ <id>scala-tools.org</id>
+ <url>http://nexus-direct.scala-tools.org/content/repositories/releases</url>
+ </repository>
+ <snapshotRepository>
+ <id>scala-tools.org</id>
+ <url>http://nexus-direct.scala-tools.org/content/repositories/snapshots</url>
+ <uniqueVersion>false</uniqueVersion>
+ </snapshotRepository>
+ <site>
+ <!-- <id>scala-tools.org</id> <url>dav:http://dav.scala-tools.org/mvnsites</url> dav protocol isn't optimized for site-deploy (very long for api) So * deploy on local file system * manually : archive
+ tar -cjvf .... * manually : put the archives to http://dav.scala-tools.org/mvnsites * manually (request admin) : unarchives on remote server <id>local</id> <url>file://${user.home}/.m2/mvnsites/${project.groupId}/</url> -->
+ <id>scala-tools.org</id>
+ <url>dav:http://nexus-direct.scala-tools.org/content/sites/mvnsites/maven-scala-plugin</url>
+ </site>
+ </distributionManagement>
+
+ <repositories>
+ <repository>
+ <id>scala-tools.org</id>
+ <name>Scala-Tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </repository>
+ <repository>
+ <id>jboss.releases</id>
+ <name>JBoss releases</name>
+ <url>http://repository.jboss.org/maven2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <developers>
+ <developer>
+ <name>David Bernard</name>
+ <timezone>+1</timezone>
+ </developer>
+ <developer>
+ <name>Josh Suereth</name>
+ </developer>
+ </developers>
+
+ <contributors>
+ <contributor>
+ <name>David Pollak</name>
+ </contributor>
+ <contributor>
+ <name>Arnaud Bailly</name>
+ </contributor>
+ <contributor>
+ <name>Jesse Eichar</name>
+ </contributor>
+ <contributor>
+ <name>Sean Griffin</name>
+ </contributor>
+ <contributor>
+ <name>James Strachan</name>
+ </contributor>
+ <contributor>
+ <name>Jim Hurne</name>
+ </contributor>
+ </contributors>
+
+ <properties>
+ <maven.version>2.2.1</maven.version>
+ <maven.compiler.source>1.5</maven.compiler.source>
+ <maven.compiler.target>1.5</maven.compiler.target>
+ <encoding>UTF-8</encoding>
+ </properties>
+
+ <prerequisites>
+ <maven>${maven.version}</maven>
+ </prerequisites>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>${maven.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>${maven.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.reporting</groupId>
+ <artifactId>maven-reporting-api</artifactId>
+ <version>${maven.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>${maven.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-dependency-tree</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-exec</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>${maven.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.doxia</groupId>
+ <artifactId>doxia-sink-api</artifactId>
+ <version>1.1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>${maven.version}</version>
+ </dependency>
+ <!-- for scala:genjson -->
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-core-asl</artifactId>
+ <version>1.6.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ <version>1.6.1</version>
+ </dependency>
+ <!-- for scala:cctest -->
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-invoker</artifactId>
+ <version>2.0.11</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>2.6</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>2.1.2</version>
+ <inherited>false</inherited>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.7</version>
+ <configuration>
+ <doclet>org.jboss.apiviz.APIviz</doclet>
+ <docletArtifact>
+ <groupId>org.jboss.apiviz</groupId>
+ <artifactId>apiviz</artifactId>
+ <version>1.3.0.GA</version>
+ </docletArtifact>
+ <useStandardDocletOptions>true</useStandardDocletOptions>
+ <charset>UTF-8</charset>
+ <encoding>UTF-8</encoding>
+ <docencoding>UTF-8</docencoding>
+ <breakiterator>true</breakiterator>
+ <version>true</version>
+ <author>true</author>
+ <keywords>true</keywords>
+ <additionalparam>-sourceclasspath ${project.build.outputDirectory}</additionalparam>
+ <minmemory>128m</minmemory>
+ <maxmemory>512m</maxmemory>
+ <links>
+ <link>http://java.sun.com/j2se/${maven.compiler.source}/docs/api/</link>
+ <link>http://slf4j.org/api/</link>
+ <link>http://jakarta.apache.org/commons/logging/apidocs/</link>
+ <link>http://logging.apache.org/log4j/docs/api/</link>
+ <link>http://people.apache.org/~tobrien/wicket/apidocs/</link>
+ <link>http://commons.apache.org/lang/api-release/</link>
+ <link>http://commons.apache.org/io/api-release/</link>
+ <link>http://testng.org/javadocs/</link>
+ <link>http://junit.sourceforge.net/javadoc/</link>
+ </links>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jxr-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>taglist-maven-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <tags>
+ <tag>TODO</tag>
+ <tag>FIXME</tag>
+ <tag>@todo</tag>
+ <tag>@deprecated</tag>
+ </tags>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-changes-plugin</artifactId>
+ <version>2.3</version>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>changes-report</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>2.1.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-docck-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <!-- make sure our code doesn't have 1.6 dependencies except where we know it see * http://mojo.codehaus.org/animal-sniffer/index.html * http://weblogs.java.net/blog/kohsuke/archive/2008/11/compiling_with.html -->
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>animal-sniffer-maven-plugin</artifactId>
+ <version>1.5</version>
+ <configuration>
+ <signature>
+ <groupId>org.codehaus.mojo.signature</groupId>
+ <artifactId>java15</artifactId>
+ <version>1.0</version>
+ </signature>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-changes-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <template>announcement.md.vm</template>
+ <templateDirectory>announcements</templateDirectory>
+ <mailSender>
+ <name>David Bernard</name>
+ <email>david.bernard.31 at gmail.com</email>
+ </mailSender>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.1</version>
+ <configuration>
+ <releaseProfiles>release</releaseProfiles>
+ <goals>install animal-sniffer:check deploy site-deploy assembly:assembly</goals>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+ <profiles>
+ <profile>
+ <id>integration-tests</id>
+ <activation>
+ <property>
+ <name>maven.test.skip</name>
+ <value>!true</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.5</version>
+ <configuration>
+ <settingsFile>src/it/settings.xml</settingsFile>
+ <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+ <properties>
+ <scala.version.27>2.7.7</scala.version.27>
+ <scala.version.28>2.8.0</scala.version.28>
+ <scala.version.lastrelease>2.8.0</scala.version.lastrelease>
+ <scala.version.next>2.8.1.RC2</scala.version.next>
+ </properties>
+ <debug>false</debug>
+ <streamLogs>true</streamLogs>
+ <projectsDirectory>src/it</projectsDirectory>
+ <pomIncludes>
+ <pomInclude>**/pom.xml</pomInclude>
+ </pomIncludes>
+ <pomExcludes>
+ <pomExclude>**/off-*/pom.xml</pomExclude>
+ <!-- submodule -->
+ <pomExclude>**/m*/pom.xml</pomExclude>
+ <pomExclude>scalac-plugin/src/it/**/pom.xml</pomExclude>
+ </pomExcludes>
+ <preBuildHookScript>setup.groovy</preBuildHookScript>
+ <postBuildHookScript>validate.groovy</postBuildHookScript>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>install</goal>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>release</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <!-- <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>rat-maven-plugin</artifactId> <version>1.0-alpha-3</version> <executions> <execution> <phase>validate</phase> <goals> <goal>check</goal>
+ </goals> </execution> </executions> <configuration> <includes> <include>src/**</include> </includes> <excludes> <exclude>**/*.xml</exclude> <exclude>src/site/**</exclude> <exclude>src/main/resources/**</exclude>
+ <exclude>src/test/**</exclude> </excludes> </configuration> </plugin> -->
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ </plugin>
+ <!-- <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <descriptorRefs> <descriptorRef>project</descriptorRef> </descriptorRefs> </configuration> <executions> <execution>
+ <id>make-assembly</id> <phase>package</phase> <goals> <goal>attached</goal> </goals> </execution> </executions> </plugin> -->
+ </plugins>
+ </build>
+ <!-- <distributionManagement> <site> <id>local</id> <url>file://${user.home}/.m2/mvnsites/${project.groupId}/</url> </site> </distributionManagement> -->
+ </profile>
+ <profile>
+ <id>maven-3</id>
+ <activation>
+ <file>
+ <!-- This employs that the basedir expression is only recognized by Maven 3.x (see MNG-2363) -->
+ <exists>${basedir}</exists>
+ </file>
+ </activation>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.0-beta-2</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
new file mode 100644
index 0000000..08d62e4
--- /dev/null
+++ b/src/changes/changes.xml
@@ -0,0 +1,169 @@
+<?xml version="1.0"?>
+<document>
+ <properties>
+ <title>Changes</title>
+ <author>David Bernard</author>
+ </properties>
+ <body>
+ <release version="2.15.2" date="2011-02-06" description="">
+ <action dev="David Bernard" type="add">archive generated by scala:genjson into $HOME/.config/vscaladoc2/apis can be intalled/deployed like regular artifact</action>
+ </release>
+ <release version="2.15.1" date="2011-01-25" description="">
+ <action dev="Jim Hurne" type="fix">Fixed bug with cctest that caused the tests to not run if there are no main source files but there are test source files</action>
+ <action dev="Jim Hurne" type="add">Add ccTestGoals parameters to choose others test goals (eg: scalatest:test)</action>
+ <action dev="David Bernard" type="update">scala:genjson can support custom json configuration</action>
+ <action dev="David Bernard" type="update">scala:genjson upgrade default version of vscaladoc2_genjson to 0.3</action>
+ </release>
+ <release version="2.15.0" date="2010-11-11" description="genjson">
+ <action dev="David Bernard" type="add">Add scala:genjson to generate scaladoc in json format (via vscaladoc2_genjson)</action>
+ </release>
+ <release version="2.14.3" date="2010-10-25" description="fix scala:cc">
+ <action dev="David Bernard" type="fix">scala:cc and scala:cctest raise an "UnsupportedOperationException: USELESS"</action>
+ </release>
+ <release version="2.14.2" date="2010-10-14" description="new continuous testing feature">
+ <action dev="James Strachan" type="add">New scala:cctest goal for Continuous Testing of Scala projects</action>
+ <action dev="James Strachan" type="fix">scala:cc now works OK if verbose is enabled</action>
+ <action dev="David Bernard" type="update">scala:doc now works with maven 3.0 (and maven-site-plugin 3.0-beta-2)</action>
+ <action dev="David Bernard" type="fix">fix issue in finding the compiler for scala's version with modifier prefixed by '.' instead of '-' like 2.8.1.RC2</action>
+ </release>
+ <release version="2.14.1" date="2010-07-21" description="">
+ <action dev="Ross A. Baker" type="fix">aggregate vscaladoc should not run with scaladoc(2)</action>
+ </release>
+ <release version="2.14" date="2010-06-27" description="scalac integration and other minor updates">
+ <action dev="David Bernard" type="fix">Allow scala:doc to generate scaladoc for multi-level projects like lift (quick fix)</action>
+ <action dev="Miles Sabin" type="add">first raw integration with tycho</action>
+ <action dev="David Bernard" type="update">script no longer include default import (like for Conversion, as it will not be part of scala 2.8)</action>
+ <action dev="David Bernard" type="update">change the classpath rules for running and compiling script (see doc)</action>
+ <action dev="David Bernard" type="update">property 'maven.scala.displayCmd' replaced by 'displayCmd' shorter for command line typing</action>
+ <action dev="David Bernard" type="update">property 'maven.scala.version' replaced by 'scala.version' to avoid over-configuration</action>
+ <action dev="Indrajit Raychaudhuri" type="update">scaladoc goal now executes generate-sources before executing</action>
+ <action dev="Josh Suereth" type="update">Documentation for scalac arguments updated in usage_compiler.html</action>
+ <action dev="Josh Suereth" type="update">Dependent Artifacts are now listed when there are scala version mismtaches detected</action>
+ <action dev="Josh Suereth" type="fix">Scalac plugins now sent to REPL when executing scala:console</action>
+ <action dev="David Bernard" type="update">the list of source to compile is sorted by path to allow better "reproductible" build across box (as scalac seems sensible to file order)</action>
+ <action dev="David Bernard" type="update">add redirection of spawned process to (java.io.tmpdir)/(mainClassName).(err|out)</action>
+ <action dev="David Bernard" type="add">integration with ScalaCS</action>
+ </release>
+ <release version="2.13" date="2009-11-23" description="editor/ide integration enhancement">
+ <action dev="David Bernard" type="update">compile, test-compile, cc compile all files by default</action>
+ <action dev="David Bernard" type="add">compile, test-compile, cc log the root directories of compilation of the list of files that will be compiled (to allow editor/IDE to reset markers/annotation)</action>
+ <action dev="David Bernard" type="update">output line from compiler are redirected to maven's logger in forked mode => prefixed by [ERROR]/[WARN]/[INFO] + ease integration with m2eclipse (FULL_BUILD)</action>
+ <action dev="David Bernard" type="add">prepare integration of scala-tool-server (sts) with the goal sts-init</action>
+ <action dev="David Bernard" type="fix" due-to="awhitford" issue="16">fix documentation of default value for goal's configuration (http://github.com/davidB/maven-scala-plugin/issues/unreads#issue/16)</action>
+ <action dev="David Bernard" type="fix" due-to="Christophe Dehlinger">fix regression of 2.12 where scala:cc stop/exit at first error</action>
+ <action dev="David Bernard" type="update">rename packages to use a "flat one level" : org.scala_tools.maven.xxx => org_scala_tools_maven_xxx (ease file / web browsing)</action>
+ <action dev="David Bernard" type="delete">remove yaml as pom (maven-yamlpom-plugin doesn't support !true as properties value)</action>
+ </release>
+ <release version="2.12" date="2009-10-06" description="IO Windows fixes">
+ <action dev="David Bernard" type="fix">fix "Broken Pipe" issue on Windows</action>
+ <action dev="David Bernard" type="add">use Yaml to manage pom (thanks to maven-yamlpom-plugin http://wiki.github.com/mrdon/maven-yamlpom-plugin)</action>
+ <action dev="Josh Suereth" type="add">compile and doc mojo now use includes and excludes configuration.</action>
+ <action dev="Josh Suereth" type="fix">fixed documentation errors from 2.11. Added start of FAQ section</action>
+ <action dev="Nicholas Tung" type="fix">compilerPlugin configuration now pulls in transitive dependencies.</action>
+ <action dev="Sean Griffin" type="fix">Ensure doc is written to site/scaladoc directory with both scala:doc and site goals</action>
+ <action dev="Josh Suereth + Kevin Wright" type="fix">mvn scala:console now works from windows</action>
+ <action dev="Josh Suereth" type="fix">Once again mvn scala:console does *not* compile the project. See the FAQ</action>
+ <action dev="David Bernard" type="fix">the plugin work with snapshot version of scala-library and scala-compiler</action>
+ <action dev="Heiko Seeberger" type="update">now failOnMultipleScalaVersions == true stop the build</action>
+ </release>
+ <release version="2.11" date="2009-06-29" description="">
+ <action dev="David Bernard" type="fix">fix vscaladoc aggregation to work with maven 2.1.0</action>
+ <action dev="David Bernard" type="update">replace shitty by maven-invoker-plugin to run integration-test (shitty doesn't work with maven 2.1.0)</action>
+ <action dev="David Bernard" type="fix">add jline in the classpath of scala:console to enable REPL enhancement when jline is available</action>
+ <action dev="David Bernard" type="add">For scala version prior to 2.8.0, maven-scala-plugin could use a file to pass arguments to Main. This fixes issues on OSes with argument length limitations (like windows)</action>
+ <action dev="Josh Suereth" type="add">For scala version 2.8.0 and above, maven-scala-plugin now uses the @ argument to pass arguments via a file. This fixes issues on OSes with argument length limitations (like windows)</action>
+ <action dev="David Bernard" type="add">allow running vscaladoc aggregation only from command line use "-Dforce-aggregate=true" (avoid using in pom.xml)</action>
+ <action dev="David Bernard" type="fix">disable use of ConsolePiper that generate an echo of command when running scala:console</action>
+ </release>
+ <release version="2.10.1" date="2009-03-05" description="">
+ <action dev="Josh Suereth & David Bernard" type="fix">No longer using Josh's dumb algorithm when checking for multiple scala versions.</action>
+ </release>
+ <release version="2.10" date="2009-03-01" description="">
+ <action dev="Josh Suereth" type="fix">doc goal now behaves like compiler when looking for scala version.</action>
+ <action dev="Arnaud Bailly" type="fix">test source directory parameter (testSourceDir) is now added to the testSourceDirectories (instead of compile source directories).</action>
+ <action dev="Josh Suereth" type="add">Added support for executing scalac plugins.</action>
+ <action dev="Josh Suereth" type="add">Added support for optional forking of scalac.</action>
+ <action dev="Josh Suereth" type="add">Added support to turn off sending Java source to scalac.</action>
+ <action dev="Josh Suereth" type="add">Plugin now detects multiple versions of scala library and issues a warning/fails.</action>
+ </release>
+ <release version="2.9.2" date="2008-12-??" description="">
+ <action dev="Josh Suereth" type="add">Added documentation for Java/Scala combined projects. Updated integration tests to ensure it works appropriately.</action>
+ <action dev="David Bernard" type="fix">wrong split of -DaddArgs when running 'mvn scala:run -DmainClass=scala.tools.nsc.Main -DaddArgs="scriptName"'</action>
+ </release>
+ <release version="2.9.1" date="2008-12-05" description="">
+ <action dev="Josh Suereth" type="fix">Console goal now executes project compile beforehand</action>
+ <action dev="Josh Suereth" type="fix">does *not* send all java files to the scala compiler for versions prior to 2.7.2</action>
+ </release>
+ <release version="2.9" date="2008-12-03" description="support mixed java/scala projects">
+ <action dev="Josh Suereth" type="add">added support to look in all registered source directories for scala files</action>
+ <action dev="Josh Suereth" type="add">now send all java files to the scala compiler</action>
+ <action dev="Josh Suereth" type="fix">fixed minor issues in documentation xml</action>
+ <action dev="Josh Suereth" type="add">added support for automatic integration tests</action>
+ </release>
+ <release version="2.8" date="2008-09-27" description="">
+ <action dev="David Bernard" type="fix">redefine the run goal at the test-compile phase, to have a correct classpath</action>
+ <action dev="Jesse Eichar" type="add">add ability to run scala script (from pom.xml or external file)</action>
+ <action dev="David Bernard" type="fix">detection of the scala version use the test scope when compiling test classes</action>
+ <action dev="David Bernard" type="update">rename 'scalaJars' configuration attribute to 'dependencies'</action>
+ </release>
+ <release version="2.7" date="2008-08-25" description="">
+ <action dev="David Bernard" type="update">no more add scala-dbc and scala-decoder to the classpath when running scaladoc, compiler (to be compatible with 2.7.2)</action>
+ <action dev="David Bernard" type="add">auto-detect the scala-compiler version from the scala-library version declared as dependency</action>
+ <action dev="David Bernard" type="add">add an alternate format for compiler output if maven is called with "-DemacsMode=true"</action>
+ <action dev="David Bernard" type="add">add launchers : predefined configuration for scala:run</action>
+ <action dev="David Bernard" type="update">change the source host from code.google.com to github</action>
+ </release>
+ <release version="2.6" date="2008-05-08" description="upgrade scaladoc 2.7.1">
+ <action dev="David Bernard" type="update">add a shortcut config to use vscaladoc : vscaladocVersion, it's an alias of using the previous scaladocClassName and scalaJars</action>
+ <action dev="David Bernard" type="update">update the doc goal to support scala 2.7.1 (change the way to call scaladoc)</action>
+ </release>
+ <release version="2.5.1" date="2008-03-29" description="vscaladoc support">
+ <action dev="David Bernard" type="add">fix a bug in custom scaladoc and call to "mvn site"</action>
+ </release>
+ <release version="2.5" date="2008-03-19" description="compile only">
+ <action dev="David Bernard" type="add">add the option "once" to scala:cc, if once == true then it is not a continuous compilation but run once = compile only (no check on resources,...)</action>
+ </release>
+ <release version="2.4" date="2008-03-02" description="improve custom scaladoc">
+ <action dev="David Bernard" type="add">add the configuration parameter scaladocClassName to allow custom scaladoc Main</action>
+ </release>
+ <release version="2.3" date="2008-01-17" description="improve custom compilation">
+ <action dev="David Bernard" type="add">add continuous compilation : compilation run in loop and compile only modified file (non-stop)</action>
+ <action dev="David Bernard" type="add">add configuration scalaJars for additional jar in the classpath of scalaMainClass (improve support of custom main/compiler)</action>
+ </release>
+ <release version="2.2" date="2007-12-12" description="work with console">
+ <action dev="David Bernard" type="update">compile and testCompile, only compile newer source file modification than the last compilation</action>
+ <action dev="David Bernard" type="add">add basic support of javarebel into the console goal</action>
+ <action dev="David Bernard" type="add">the console goal (with history and line navigation)</action>
+ <action dev="David Bernard" type="update">linksource option of scaladoc, default is now true</action>
+ <action dev="David Bernard" type="update">call "scalac -help -X -Y" for scala:help</action>
+ <action dev="David Bernard" type="fix">location/directory of scaladocs for modules</action>
+ </release>
+
+ <release version="2.1" date="2007-11-18" description="documentation fix">
+ <action dev="David Bernard" type="fix">scaladoc bottom substitution</action>
+ <action dev="David Bernard" type="fix">location/directory of scaladocs</action>
+ <action dev="David Bernard" type="fix">add license to header of source file</action>
+ </release>
+
+ <release version="2.0" date="2007-11-15" description="first scala-tools version">
+ <action dev="David Bernard" type="update">change groupId to org.scala-tools</action>
+ <action dev="David Bernard" type="add">add reports to the genereted site</action>
+ <action dev="David Bernard" type="add">generate scaladoc like javadoc (as a report)</action>
+ <action dev="David Bernard" type="add">add support for scaladoc's options (footer, windowtitle,...)</action>
+ <action dev="David Bernard" type="add">the help goal to display compiler arguments</action>
+ <action dev="David Bernard" type="add">allow to display the command line used</action>
+ <action dev="David Bernard" type="add">allow to choose the version of scala compiler</action>
+ <action dev="David Bernard" type="add">use 'args' and 'jvmArgs' to provide complementary options to scala</action>
+ <action dev="David Bernard" type="remove">remove configuration entry : memorymax, memorymin, deprected...</action>
+ <action dev="David Bernard" type="fix">support for source code not under src/main/scala</action>
+ <action dev="David Bernard" type="fix">compile test, with the test dependencies</action>
+ <action dev="David Bernard" type="fix">execute the "run" goal with the runtime dependencies</action>
+ <action dev="David Bernard" type="fix">declare scala-compiler as a plugin dependencies,
+ so it is no more needed to declare scala-compiler
+ as a project's dependencies</action>
+ <action dev="David Bernard" type="fix">goals are documented via the standard maven-plugin-report</action>
+ </release>
+
+ <release version="1.0" date="2007-04-18" description="millstone.iodp.tamu.edu/blambi version"></release>
+ </body>
+</document>
diff --git a/src/it/27_scalac-plugin/invoker.properties b/src/it/27_scalac-plugin/invoker.properties
new file mode 100644
index 0000000..1470eb2
--- /dev/null
+++ b/src/it/27_scalac-plugin/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=clean integration-test
diff --git a/src/it/27_scalac-plugin/pom.xml b/src/it/27_scalac-plugin/pom.xml
new file mode 100644
index 0000000..851cf78
--- /dev/null
+++ b/src/it/27_scalac-plugin/pom.xml
@@ -0,0 +1,82 @@
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>test-scalac-plugin</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>Test scalac plugin feature</name>
+ <repositories>
+ <repository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </pluginRepository>
+ </pluginRepositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-compiler</artifactId>
+ <version>${scala.version.27}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>add-source</goal>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <jvmArgs>
+ <jvmArg>-Xms64m</jvmArg>
+ <jvmArg>-Xmx1024m</jvmArg>
+ </jvmArgs>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.5</version>
+ <configuration>
+ <properties>
+ <scala.version.27>2.7.7</scala.version.27>
+ <scala.version.28>2.8.0</scala.version.28>
+ <scala.version.lastrelease>2.8.0</scala.version.lastrelease>
+ <scala.version.next>2.8.1.RC2</scala.version.next>
+ </properties>
+ <debug>false</debug>
+ <projectsDirectory>src/it</projectsDirectory>
+ <pomIncludes>
+ <pomInclude>**/pom.xml</pomInclude>
+ </pomIncludes>
+ <preBuildHookScript>setup.groovy</preBuildHookScript>
+ <postBuildHookScript>validate.groovy</postBuildHookScript>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>install</goal>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/src/it/27_scalac-plugin/src/it/plugin-test/invoker.properties b/src/it/27_scalac-plugin/src/it/plugin-test/invoker.properties
new file mode 100644
index 0000000..f78a355
--- /dev/null
+++ b/src/it/27_scalac-plugin/src/it/plugin-test/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=clean compile
diff --git a/src/it/27_scalac-plugin/src/it/plugin-test/pom.xml b/src/it/27_scalac-plugin/src/it/plugin-test/pom.xml
new file mode 100644
index 0000000..63c593a
--- /dev/null
+++ b/src/it/27_scalac-plugin/src/it/plugin-test/pom.xml
@@ -0,0 +1,72 @@
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>testPluginWorks</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>test-test-scalac-plugin</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-compiler</artifactId>
+ <version>${scala.version.27}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>add-source</goal>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <compilerPlugins>
+ <compilerPlugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>test-scalac-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </compilerPlugin>
+ </compilerPlugins>
+ <args>
+ <arg>-verbose</arg>
+ </args>
+ <displayCmd>true</displayCmd>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </pluginRepository>
+ <pluginRepository>
+ <id>snapshots.scala-tools.org</id>
+ <name>Scala-tools Maven2 Snapshot Repository</name>
+ <url>http://scala-tools.org/repo-snapshots</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+</project>
diff --git a/src/it/27_scalac-plugin/src/it/plugin-test/src/main/scala/TestWidget.scala b/src/it/27_scalac-plugin/src/it/plugin-test/src/main/scala/TestWidget.scala
new file mode 100644
index 0000000..41a8b9a
--- /dev/null
+++ b/src/it/27_scalac-plugin/src/it/plugin-test/src/main/scala/TestWidget.scala
@@ -0,0 +1,7 @@
+
+class TestWidget {
+ var myVar = 5
+
+ var otherVar = 10
+
+}
\ No newline at end of file
diff --git a/src/it/27_scalac-plugin/src/it/plugin-test/validate.groovy b/src/it/27_scalac-plugin/src/it/plugin-test/validate.groovy
new file mode 100644
index 0000000..5e5dfdb
--- /dev/null
+++ b/src/it/27_scalac-plugin/src/it/plugin-test/validate.groovy
@@ -0,0 +1,12 @@
+try {
+
+ def file = new File(basedir, 'target/classes/test-plugin.out')
+ assert file.exists()
+
+
+ return true
+
+} catch(Throwable e) {
+ e.printStackTrace()
+ return false
+}
\ No newline at end of file
diff --git a/src/it/27_scalac-plugin/src/main/resources/scalac-plugin.xml b/src/it/27_scalac-plugin/src/main/resources/scalac-plugin.xml
new file mode 100644
index 0000000..786972b
--- /dev/null
+++ b/src/it/27_scalac-plugin/src/main/resources/scalac-plugin.xml
@@ -0,0 +1,4 @@
+<plugin>
+ <name>test-scalac-plugin</name>
+ <classname>TestPlugin</classname>
+</plugin>
\ No newline at end of file
diff --git a/src/it/27_scalac-plugin/src/main/scala/TestPlugin.scala b/src/it/27_scalac-plugin/src/main/scala/TestPlugin.scala
new file mode 100644
index 0000000..0109cc2
--- /dev/null
+++ b/src/it/27_scalac-plugin/src/main/scala/TestPlugin.scala
@@ -0,0 +1,47 @@
+import scala.tools.nsc
+import nsc._
+import nsc.plugins.Plugin
+import nsc.plugins.PluginComponent
+
+import java.{io => jio}
+/**
+ * Our privatesetter plugin class that contributes a new phase to the compiler.
+ */
+class TestPlugin(val global : Global) extends Plugin {
+
+ val name = "test-plugin"
+ val description = "allows vars to have private setters"
+ val components = List[PluginComponent](VarAccessChanger)
+
+
+ /** Plugin component to complete dependency analysis after a build and write out dependnecies for next build */
+ private object VarAccessChanger extends PluginComponent {
+ val global = TestPlugin.this.global
+ val runsAfter = "typer"
+ val phaseName = "test-phase"
+ def newPhase(prev: Phase) = new MakeSettersPrivatePhase(prev)
+ def name = phaseName
+
+ /** The actual phase the removes units from being compiled that are up-to-date */
+ class MakeSettersPrivatePhase(prev: Phase) extends Phase(prev) {
+
+ override def name = VarAccessChanger.this.name
+ import global._
+ /**
+ * Called when our plugin is running.
+ */
+ override def run {
+ val outdir = new jio.File(global.settings.outdir.value)
+ if(!outdir.isDirectory) {
+ outdir.mkdirs()
+ }
+ val file = new jio.File(outdir, "test-plugin.out")
+ Console.println("Writing file: " + file)
+ if(!file.exists()) {
+ file.createNewFile()
+ }
+ }
+
+ }
+ }
+}
diff --git a/src/it/27_scaladocOnMultiModules/invoker.properties b/src/it/27_scaladocOnMultiModules/invoker.properties
new file mode 100644
index 0000000..e9f232a
--- /dev/null
+++ b/src/it/27_scaladocOnMultiModules/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=clean compile scala:doc
diff --git a/src/it/27_scaladocOnMultiModules/m1/pom.xml b/src/it/27_scaladocOnMultiModules/m1/pom.xml
new file mode 100644
index 0000000..eab7e57
--- /dev/null
+++ b/src/it/27_scaladocOnMultiModules/m1/pom.xml
@@ -0,0 +1,20 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.scala-tools.maven-scala-plugin</groupId>
+ <artifactId>it-parent</artifactId>
+ <version>testing</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>m1</artifactId>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>${scala.version.27}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/src/it/27_scaladocOnMultiModules/m1/src/main/scala/p1/MyClass.scala b/src/it/27_scaladocOnMultiModules/m1/src/main/scala/p1/MyClass.scala
new file mode 100644
index 0000000..46942e6
--- /dev/null
+++ b/src/it/27_scaladocOnMultiModules/m1/src/main/scala/p1/MyClass.scala
@@ -0,0 +1,8 @@
+package p1
+
+class MyClass {
+}
+
+//Companion Class
+object MyClass {
+}
\ No newline at end of file
diff --git a/src/it/27_scaladocOnMultiModules/m2/pom.xml b/src/it/27_scaladocOnMultiModules/m2/pom.xml
new file mode 100644
index 0000000..2d80edb
--- /dev/null
+++ b/src/it/27_scaladocOnMultiModules/m2/pom.xml
@@ -0,0 +1,20 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.scala-tools.maven-scala-plugin</groupId>
+ <artifactId>it-parent</artifactId>
+ <version>testing</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>m2</artifactId>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>${scala.version.27}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/src/it/27_scaladocOnMultiModules/m2/src/main/scala/p2/MyClass.scala b/src/it/27_scaladocOnMultiModules/m2/src/main/scala/p2/MyClass.scala
new file mode 100644
index 0000000..e137463
--- /dev/null
+++ b/src/it/27_scaladocOnMultiModules/m2/src/main/scala/p2/MyClass.scala
@@ -0,0 +1,8 @@
+package p2
+
+class MyClass {
+}
+
+//Companion Class
+object MyClass {
+}
\ No newline at end of file
diff --git a/src/it/27_scaladocOnMultiModules/pom.xml b/src/it/27_scaladocOnMultiModules/pom.xml
new file mode 100644
index 0000000..ec610e5
--- /dev/null
+++ b/src/it/27_scaladocOnMultiModules/pom.xml
@@ -0,0 +1,72 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.scala-tools.maven-scala-plugin</groupId>
+ <artifactId>it-parent</artifactId>
+ <version>testing</version>
+ <name>Test scaladoc generation+aggregation</name>
+ <packaging>pom</packaging>
+ <repositories>
+ <repository>
+ <id>scala-tools.org</id>
+ <name>Scala Tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </repository>
+ <repository>
+ <id>scala-tools.org.snapshots</id>
+ <name>Scala Tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-snapshots</url>
+ <snapshots />
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>${scala.version.27}</version>
+ </dependency>
+ </dependencies>
+
+ <url>http://sandbox/</url>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <modules>
+ <module>m1</module>
+ <module>m2</module>
+ </modules>
+</project>
diff --git a/src/it/27_scaladocOnMultiModules/validate.groovy b/src/it/27_scaladocOnMultiModules/validate.groovy
new file mode 100644
index 0000000..66f0411
--- /dev/null
+++ b/src/it/27_scaladocOnMultiModules/validate.groovy
@@ -0,0 +1,11 @@
+try {
+
+assert new File(basedir, 'm1/target/site/scaladocs/p1/MyClass.html').exists()
+assert new File(basedir, 'm2/target/site/scaladocs/p2/MyClass.html').exists()
+
+return true
+
+} catch(Throwable e) {
+ e.printStackTrace()
+ return false
+}
diff --git a/src/it/27_vscaladocOnMultiModules/invoker.properties b/src/it/27_vscaladocOnMultiModules/invoker.properties
new file mode 100644
index 0000000..190b346
--- /dev/null
+++ b/src/it/27_vscaladocOnMultiModules/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=clean compile site
diff --git a/src/it/27_vscaladocOnMultiModules/m1/pom.xml b/src/it/27_vscaladocOnMultiModules/m1/pom.xml
new file mode 100644
index 0000000..eab7e57
--- /dev/null
+++ b/src/it/27_vscaladocOnMultiModules/m1/pom.xml
@@ -0,0 +1,20 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.scala-tools.maven-scala-plugin</groupId>
+ <artifactId>it-parent</artifactId>
+ <version>testing</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>m1</artifactId>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>${scala.version.27}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/src/it/27_vscaladocOnMultiModules/m1/src/main/scala/p1/MyClass.scala b/src/it/27_vscaladocOnMultiModules/m1/src/main/scala/p1/MyClass.scala
new file mode 100644
index 0000000..46942e6
--- /dev/null
+++ b/src/it/27_vscaladocOnMultiModules/m1/src/main/scala/p1/MyClass.scala
@@ -0,0 +1,8 @@
+package p1
+
+class MyClass {
+}
+
+//Companion Class
+object MyClass {
+}
\ No newline at end of file
diff --git a/src/it/27_vscaladocOnMultiModules/m2/pom.xml b/src/it/27_vscaladocOnMultiModules/m2/pom.xml
new file mode 100644
index 0000000..2d80edb
--- /dev/null
+++ b/src/it/27_vscaladocOnMultiModules/m2/pom.xml
@@ -0,0 +1,20 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.scala-tools.maven-scala-plugin</groupId>
+ <artifactId>it-parent</artifactId>
+ <version>testing</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>m2</artifactId>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>${scala.version.27}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/src/it/27_vscaladocOnMultiModules/m2/src/main/scala/p2/MyClass.scala b/src/it/27_vscaladocOnMultiModules/m2/src/main/scala/p2/MyClass.scala
new file mode 100644
index 0000000..e137463
--- /dev/null
+++ b/src/it/27_vscaladocOnMultiModules/m2/src/main/scala/p2/MyClass.scala
@@ -0,0 +1,8 @@
+package p2
+
+class MyClass {
+}
+
+//Companion Class
+object MyClass {
+}
\ No newline at end of file
diff --git a/src/it/27_vscaladocOnMultiModules/pom.xml b/src/it/27_vscaladocOnMultiModules/pom.xml
new file mode 100644
index 0000000..37963e8
--- /dev/null
+++ b/src/it/27_vscaladocOnMultiModules/pom.xml
@@ -0,0 +1,75 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.scala-tools.maven-scala-plugin</groupId>
+ <artifactId>it-parent</artifactId>
+ <version>testing</version>
+ <name>Test scaladoc generation+aggregation</name>
+ <packaging>pom</packaging>
+ <repositories>
+ <repository>
+ <id>scala-tools.org</id>
+ <name>Scala Tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </repository>
+ <repository>
+ <id>scala-tools.org.snapshots</id>
+ <name>Scala Tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-snapshots</url>
+ <snapshots />
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>${scala.version.27}</version>
+ </dependency>
+ </dependencies>
+
+ <url>http://sandbox/</url>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <vscaladocVersion>1.2-m1</vscaladocVersion>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <modules>
+ <module>m1</module>
+ <module>m2</module>
+ </modules>
+</project>
diff --git a/src/it/27_vscaladocOnMultiModules/validate.groovy b/src/it/27_vscaladocOnMultiModules/validate.groovy
new file mode 100644
index 0000000..d607540
--- /dev/null
+++ b/src/it/27_vscaladocOnMultiModules/validate.groovy
@@ -0,0 +1,21 @@
+try {
+
+assert new File(basedir, 'm1/target/site/scaladocs/p1/MyClass.html').exists()
+assert new File(basedir, 'm1/target/site/scaladocs/overview.html').exists()
+assert new File(basedir, 'm1/target/site/scaladocs/all-classes.html').exists()
+
+assert new File(basedir, 'm2/target/site/scaladocs/p2/MyClass.html').exists()
+assert new File(basedir, 'm2/target/site/scaladocs/overview.html').exists()
+assert new File(basedir, 'm2/target/site/scaladocs/all-classes.html').exists()
+
+assert new File(basedir, 'target/site/scaladocs/p1/MyClass.html').exists()
+assert new File(basedir, 'target/site/scaladocs/p2/MyClass.html').exists()
+assert new File(basedir, 'target/site/scaladocs/overview.html').exists()
+assert new File(basedir, 'target/site/scaladocs/all-classes.html').exists()
+
+return true
+
+} catch(Throwable e) {
+ e.printStackTrace()
+ return false
+}
\ No newline at end of file
diff --git a/src/it/includesExcludes/invoker.properties b/src/it/includesExcludes/invoker.properties
new file mode 100644
index 0000000..190b346
--- /dev/null
+++ b/src/it/includesExcludes/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=clean compile site
diff --git a/src/it/includesExcludes/pom.xml b/src/it/includesExcludes/pom.xml
new file mode 100644
index 0000000..09b0948
--- /dev/null
+++ b/src/it/includesExcludes/pom.xml
@@ -0,0 +1,77 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.scala-tools.maven-scala-plugin</groupId>
+ <artifactId>includesExcludes</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Test compilation using excludes/includes</name>
+ <description>Test compilation pulls version from dependency</description>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>${scala.version.lastrelease}</version>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </pluginRepository>
+ </pluginRepositories>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <includes>
+ <include>**/*.scala</include>
+ <include>**/TestClass.java</include>
+ </includes>
+ <excludes>
+ <exclude>bad.scala</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*.scala</include>
+ <include>**/TestClass.java</include>
+ </includes>
+ <excludes>
+ <exclude>bad.scala</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>
diff --git a/src/it/includesExcludes/src/main/java/TestClass.java b/src/it/includesExcludes/src/main/java/TestClass.java
new file mode 100644
index 0000000..a48fb72
--- /dev/null
+++ b/src/it/includesExcludes/src/main/java/TestClass.java
@@ -0,0 +1,4 @@
+
+class TestClass {
+
+}
\ No newline at end of file
diff --git a/src/it/includesExcludes/src/main/scala/MyClass.scala b/src/it/includesExcludes/src/main/scala/MyClass.scala
new file mode 100644
index 0000000..55a17e5
--- /dev/null
+++ b/src/it/includesExcludes/src/main/scala/MyClass.scala
@@ -0,0 +1,6 @@
+class MyClass {
+}
+
+//Companion Class
+object MyClass {
+}
\ No newline at end of file
diff --git a/src/it/includesExcludes/src/main/scala/bad.scala b/src/it/includesExcludes/src/main/scala/bad.scala
new file mode 100644
index 0000000..52e81f4
--- /dev/null
+++ b/src/it/includesExcludes/src/main/scala/bad.scala
@@ -0,0 +1,3 @@
+import bad.package.name
+
+class bad extends name {}
\ No newline at end of file
diff --git a/src/it/includesExcludes/validate.groovy b/src/it/includesExcludes/validate.groovy
new file mode 100644
index 0000000..18b6e58
--- /dev/null
+++ b/src/it/includesExcludes/validate.groovy
@@ -0,0 +1,21 @@
+try {
+
+def file = new File(basedir, 'target/classes/MyClass.class')
+assert file.exists()
+
+def file2 = new File(basedir, 'target/classes/MyClass$.class')
+assert file2.exists()
+
+def file3 = new File(basedir, 'target/classes/TestClass.class')
+assert file3.exists()
+
+def file4 = new File(basedir, 'target/site/scaladocs/MyClass.html')
+assert file4.exists()
+
+
+return true
+
+} catch(Throwable e) {
+ e.printStackTrace()
+ return false
+}
\ No newline at end of file
diff --git a/src/it/mismatchedScalaVersions/invoker.properties b/src/it/mismatchedScalaVersions/invoker.properties
new file mode 100644
index 0000000..2b1497c
--- /dev/null
+++ b/src/it/mismatchedScalaVersions/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=clean compile
\ No newline at end of file
diff --git a/src/it/mismatchedScalaVersions/pom.xml b/src/it/mismatchedScalaVersions/pom.xml
new file mode 100644
index 0000000..cfaa223
--- /dev/null
+++ b/src/it/mismatchedScalaVersions/pom.xml
@@ -0,0 +1,85 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.scala-tools.maven-scala-plugin</groupId>
+ <artifactId>mismatchedScalaVersions</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Test for Mismatched Scala versions and error message output!</name>
+ <description>Test for Java + Scala compilation</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>2.7.1</version>
+ </dependency>
+ <dependency>
+ <artifactId>lift-util</artifactId>
+ <groupId>net.liftweb</groupId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openid4java</groupId>
+ <artifactId>openid4java</artifactId>
+ <version>0.9.3</version>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>scala-compile-first</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>add-source</goal>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>scala-test-compile</id>
+ <phase>process-test-resources</phase>
+ <goals>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <fork>false</fork>
+ <failOnMultipleScalaVersions>false</failOnMultipleScalaVersions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/src/it/mismatchedScalaVersions/src/main/scala/ScalaClass.scala b/src/it/mismatchedScalaVersions/src/main/scala/ScalaClass.scala
new file mode 100644
index 0000000..89866c3
--- /dev/null
+++ b/src/it/mismatchedScalaVersions/src/main/scala/ScalaClass.scala
@@ -0,0 +1,6 @@
+class ScalaClass {
+
+ def abstractJavaMethod() : Unit = {
+ Console.println("Test")
+ }
+}
\ No newline at end of file
diff --git a/src/it/mismatchedScalaVersions/validate.groovy b/src/it/mismatchedScalaVersions/validate.groovy
new file mode 100644
index 0000000..6d80af0
--- /dev/null
+++ b/src/it/mismatchedScalaVersions/validate.groovy
@@ -0,0 +1,21 @@
+try {
+
+def echoString = "[WARNING] Multiple versions of scala libraries detected!"
+def logFile = new File(basedir, "build.log")
+//Look for echo string
+def found = false;
+logFile.eachLine({ line ->
+ if(line.contains(echoString)) {
+ found = true;
+ }
+});
+
+assert found
+
+
+return true
+
+} catch(Throwable e) {
+ e.printStackTrace()
+ return false
+}
diff --git a/src/it/next_test-scalac/.scala_dependencies b/src/it/next_test-scalac/.scala_dependencies
new file mode 100644
index 0000000..e69de29
diff --git a/src/it/next_test-scalac/invoker.properties b/src/it/next_test-scalac/invoker.properties
new file mode 100644
index 0000000..e9f232a
--- /dev/null
+++ b/src/it/next_test-scalac/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=clean compile scala:doc
diff --git a/src/it/next_test-scalac/pom.xml b/src/it/next_test-scalac/pom.xml
new file mode 100644
index 0000000..4ea1de1
--- /dev/null
+++ b/src/it/next_test-scalac/pom.xml
@@ -0,0 +1,50 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.scala-tools.maven-scala-plugin</groupId>
+ <artifactId>test-scalac-nextversion</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Test compilation with the next scala version</name>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>${scala.version.next}</version>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>snapshots.scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository SNAPSHOTS</name>
+ <url>http://scala-tools.org/repo-snapshots</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </pluginRepository>
+ </pluginRepositories>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/src/it/next_test-scalac/src/main/scala/MyClass.scala b/src/it/next_test-scalac/src/main/scala/MyClass.scala
new file mode 100644
index 0000000..55a17e5
--- /dev/null
+++ b/src/it/next_test-scalac/src/main/scala/MyClass.scala
@@ -0,0 +1,6 @@
+class MyClass {
+}
+
+//Companion Class
+object MyClass {
+}
\ No newline at end of file
diff --git a/src/it/next_test-scalac/validate.groovy b/src/it/next_test-scalac/validate.groovy
new file mode 100644
index 0000000..ee43b75
--- /dev/null
+++ b/src/it/next_test-scalac/validate.groovy
@@ -0,0 +1,14 @@
+try {
+
+def file = new File(basedir, 'target/classes/MyClass.class')
+assert file.exists()
+
+def file2 = new File(basedir, 'target/classes/MyClass$.class')
+assert file2.exists()
+
+return true
+
+} catch(Throwable e) {
+ e.printStackTrace()
+ return false
+}
diff --git a/src/it/next_test-scalac/validate.groovy.save b/src/it/next_test-scalac/validate.groovy.save
new file mode 100644
index 0000000..ee43b75
--- /dev/null
+++ b/src/it/next_test-scalac/validate.groovy.save
@@ -0,0 +1,14 @@
+try {
+
+def file = new File(basedir, 'target/classes/MyClass.class')
+assert file.exists()
+
+def file2 = new File(basedir, 'target/classes/MyClass$.class')
+assert file2.exists()
+
+return true
+
+} catch(Throwable e) {
+ e.printStackTrace()
+ return false
+}
diff --git a/src/it/off-20101014_liftone/invoker.properties b/src/it/off-20101014_liftone/invoker.properties
new file mode 100644
index 0000000..bdba922
--- /dev/null
+++ b/src/it/off-20101014_liftone/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=clean package
\ No newline at end of file
diff --git a/src/it/off-20101014_liftone/pom.xml b/src/it/off-20101014_liftone/pom.xml
new file mode 100644
index 0000000..9579ca0
--- /dev/null
+++ b/src/it/off-20101014_liftone/pom.xml
@@ -0,0 +1,117 @@
+<?xml version="1.0"?><project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.scala-tools.maven-scala-plugin</groupId>
+ <artifactId>liftone</artifactId>
+ <packaging>war</packaging>
+ <name>liftone</name>
+ <version>1.0-SNAPSHOT</version>
+ <inceptionYear>2007</inceptionYear>
+ <build>
+ <sourceDirectory>src/main/scala</sourceDirectory>
+ <testSourceDirectory>src/test/scala</testSourceDirectory>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <configuration>
+ <contextPath>/</contextPath>
+ <scanIntervalSeconds>5</scanIntervalSeconds>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>net.sf.alchim</groupId>
+ <artifactId>yuicompressor-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compress</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <nosuffix>true</nosuffix>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <repositories>
+ <repository>
+ <id>scala-tools.org</id>
+ <name>Scala-Tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>scala-tools.org</id>
+ <name>Scala-Tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </pluginRepository>
+ </pluginRepositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>${scala.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.liftweb</groupId>
+ <artifactId>lift-core</artifactId>
+ <version>0.9</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.2.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ <version>[6.1.6,)</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-compiler</artifactId>
+ <version>${scala.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ </plugins>
+ </reporting>
+ <properties>
+ <scala.version>${scala.version.28}</scala.version>
+ </properties>
+</project>
\ No newline at end of file
diff --git a/src/it/off-20101014_liftone/src/main/scala/bootstrap/liftweb/Boot.scala b/src/it/off-20101014_liftone/src/main/scala/bootstrap/liftweb/Boot.scala
new file mode 100644
index 0000000..4436a0d
--- /dev/null
+++ b/src/it/off-20101014_liftone/src/main/scala/bootstrap/liftweb/Boot.scala
@@ -0,0 +1,45 @@
+package bootstrap.liftweb
+
+import net.liftweb.util._
+import net.liftweb.http._
+import net.liftweb.sitemap._
+import net.liftweb.sitemap.Loc._
+import Helpers._
+import net.liftweb.mapper.{DB, ConnectionManager, Schemifier, DefaultConnectionIdentifier, ConnectionIdentifier}
+import java.sql.{Connection, DriverManager}
+import com.liftone.model._
+
+/**
+ * A class that's instantiated early and run. It allows the application
+ * to modify lift's environment
+ */
+class Boot {
+ def boot {
+ if (!DB.jndiJdbcConnAvailable_?) DB.defineConnectionManager(DefaultConnectionIdentifier, DBVendor)
+ // where to search snippet
+ LiftRules.addToPackages("com.liftone")
+ Schemifier.schemify(true, Log.infoF _, User)
+
+ LiftRules.addTemplateBefore(User.templates)
+
+ // Build SiteMap
+ val entries = Menu(Loc("Home", "/", "Home")) :: User.sitemap
+ LiftRules.setSiteMap(SiteMap(entries:_*))
+ S.addAround(User.requestLoans)
+ }
+}
+
+
+object DBVendor extends ConnectionManager {
+ def newConnection(name: ConnectionIdentifier): Can[Connection] = {
+ try {
+ Class.forName("org.apache.derby.jdbc.EmbeddedDriver")
+ val dm = DriverManager.getConnection("jdbc:derby:lift_example;create=true")
+ Full(dm)
+ } catch {
+ case e : Exception => e.printStackTrace; Empty
+ }
+ }
+ def releaseConnection(conn: Connection) {conn.close}
+}
+
diff --git a/src/it/off-20101014_liftone/src/main/scala/com/liftone/comet/.keep b/src/it/off-20101014_liftone/src/main/scala/com/liftone/comet/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/src/it/off-20101014_liftone/src/main/scala/com/liftone/model/.keep b/src/it/off-20101014_liftone/src/main/scala/com/liftone/model/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/src/it/off-20101014_liftone/src/main/scala/com/liftone/model/User.scala b/src/it/off-20101014_liftone/src/main/scala/com/liftone/model/User.scala
new file mode 100644
index 0000000..9914a2b
--- /dev/null
+++ b/src/it/off-20101014_liftone/src/main/scala/com/liftone/model/User.scala
@@ -0,0 +1,35 @@
+package com.liftone.model
+
+import net.liftweb.mapper._
+import net.liftweb.util._
+
+/**
+ * The singleton that has methods for accessing the database
+ */
+object User extends User with MetaMegaProtoUser[User, User with KeyedMetaMapper[Long, User]] {
+ override def dbTableName = "users" // define the DB table name
+ override def screenWrap = Full(<lift:surround with="default" at="content">
+ <lift:bind /></lift:surround>)
+ // define the order fields will appear in forms and output
+ override def fieldOrder = id :: firstName :: lastName :: email ::
+ locale :: timezone ::
+ password :: textArea :: Nil
+
+ // comment this line out to require email validations
+ override def skipEmailValidation = true
+}
+
+/**
+ * An O-R mapped "User" class that includes first name, last name, password and we add a "Personal Essay" to it
+ */
+class User extends MegaProtoUser[User] {
+ def getSingleton = User // what's the "meta" server
+ def primaryKeyField = id
+
+ // define an additional field for a personal essay
+ object textArea extends MappedTextarea(this, 2048) {
+ override def textareaRows = 10
+ override def textareaCols = 50
+ override def displayName = "Personal Essay"
+ }
+}
diff --git a/src/it/off-20101014_liftone/src/main/scala/com/liftone/snippet/.keep b/src/it/off-20101014_liftone/src/main/scala/com/liftone/snippet/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/src/it/off-20101014_liftone/src/main/scala/com/liftone/snippet/HelloWorld.scala b/src/it/off-20101014_liftone/src/main/scala/com/liftone/snippet/HelloWorld.scala
new file mode 100644
index 0000000..b1bdcab
--- /dev/null
+++ b/src/it/off-20101014_liftone/src/main/scala/com/liftone/snippet/HelloWorld.scala
@@ -0,0 +1,6 @@
+package com.liftone.snippet
+
+class HelloWorld {
+ def howdy = <span>Welcome to liftone at {new java.util.Date}</span>
+}
+
diff --git a/src/it/off-20101014_liftone/src/main/scala/com/liftone/view/.keep b/src/it/off-20101014_liftone/src/main/scala/com/liftone/view/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/src/it/off-20101014_liftone/src/main/webapp/WEB-INF/web.xml b/src/it/off-20101014_liftone/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..a434743
--- /dev/null
+++ b/src/it/off-20101014_liftone/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!DOCTYPE web-app
+PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
+
+<web-app>
+<filter>
+ <filter-name>LiftFilter</filter-name>
+ <display-name>Lift Filter</display-name>
+ <description>The Filter that intercepts lift calls</description>
+ <filter-class>net.liftweb.http.LiftFilter</filter-class>
+</filter>
+
+
+<filter-mapping>
+ <filter-name>LiftFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+</filter-mapping>
+
+</web-app>
diff --git a/src/it/off-20101014_liftone/src/main/webapp/index.html b/src/it/off-20101014_liftone/src/main/webapp/index.html
new file mode 100644
index 0000000..41f9b1b
--- /dev/null
+++ b/src/it/off-20101014_liftone/src/main/webapp/index.html
@@ -0,0 +1,5 @@
+<lift:surround with="default" at="content">
+ <h2>Welcome to your project!</h2>
+ <p><lift:helloWorld.howdy /></p>
+</lift:surround>
+
diff --git a/src/it/off-20101014_liftone/src/test/scala/LiftConsole.scala b/src/it/off-20101014_liftone/src/test/scala/LiftConsole.scala
new file mode 100644
index 0000000..0d54efd
--- /dev/null
+++ b/src/it/off-20101014_liftone/src/test/scala/LiftConsole.scala
@@ -0,0 +1,15 @@
+import bootstrap.liftweb.Boot
+import scala.tools.nsc.MainGenericRunner
+
+object LiftConsole {
+ def main(args : Array[String]) {
+ // Instantiate your project's Boot file
+ val b = new Boot();
+ // Boot your project
+ b.boot;
+ // Now run the MainGenericRunner to get your repl
+ MainGenericRunner.main(args)
+ // After the repl exits, then exit the scala script
+ exit(0)
+ }
+}
diff --git a/src/it/off-20101014_liftone/src/test/scala/RunWebApp.scala b/src/it/off-20101014_liftone/src/test/scala/RunWebApp.scala
new file mode 100644
index 0000000..788bc6b
--- /dev/null
+++ b/src/it/off-20101014_liftone/src/test/scala/RunWebApp.scala
@@ -0,0 +1,28 @@
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.webapp.WebAppContext;
+
+object RunWebApp extends Application {
+ val server = new Server(8080);
+ val context = new WebAppContext()
+ context.setServer(server)
+ context.setContextPath("/")
+ context.setWar("src/main/webapp")
+
+ server.addHandler(context)
+
+ try {
+ println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP");
+ server.start();
+ while (System.in.available() == 0) {
+ Thread.sleep(5000)
+ }
+ server.stop()
+ server.join()
+ } catch {
+ case exc : Exception => {
+ exc.printStackTrace()
+ System.exit(100)
+ }
+ }
+}
diff --git a/src/it/off-20101014_liftone/src/test/scala/com/liftone/AppTest.scala b/src/it/off-20101014_liftone/src/test/scala/com/liftone/AppTest.scala
new file mode 100644
index 0000000..f6f85ba
--- /dev/null
+++ b/src/it/off-20101014_liftone/src/test/scala/com/liftone/AppTest.scala
@@ -0,0 +1,29 @@
+package com.liftone;
+
+import junit.framework._;
+import Assert._;
+
+object AppTest {
+ def suite: Test = {
+ val suite = new TestSuite(classOf[AppTest]);
+ suite
+ }
+
+ def main(args : Array[String]) {
+ junit.textui.TestRunner.run(suite);
+ }
+}
+
+/**
+ * Unit test for simple App.
+ */
+class AppTest extends TestCase("app") {
+
+ /**
+ * Rigourous Tests :-)
+ */
+ def testOK() = assertTrue(true);
+ //def testKO() = assertTrue(false);
+
+
+}
diff --git a/src/it/settings.xml b/src/it/settings.xml
new file mode 100644
index 0000000..98a0b0f
--- /dev/null
+++ b/src/it/settings.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<settings>
+ <profiles>
+ <profile>
+ <id>it-repo</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <repositories>
+ <repository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ </profiles>
+</settings>
\ No newline at end of file
diff --git a/src/it/test1/invoker.properties b/src/it/test1/invoker.properties
new file mode 100644
index 0000000..190b346
--- /dev/null
+++ b/src/it/test1/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=clean compile site
diff --git a/src/it/test1/pom.xml b/src/it/test1/pom.xml
new file mode 100644
index 0000000..0ae1558
--- /dev/null
+++ b/src/it/test1/pom.xml
@@ -0,0 +1,60 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.scala-tools.maven-scala-plugin</groupId>
+ <artifactId>test1</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>${project.artifactId}</name>
+ <description>Test compilation pulls version from dependency</description>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>2.7.1</version>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </pluginRepository>
+ </pluginRepositories>
+ <url>http://sandbox/</url>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>
diff --git a/src/it/test1/src/main/java/TestClass.java b/src/it/test1/src/main/java/TestClass.java
new file mode 100644
index 0000000..a48fb72
--- /dev/null
+++ b/src/it/test1/src/main/java/TestClass.java
@@ -0,0 +1,4 @@
+
+class TestClass {
+
+}
\ No newline at end of file
diff --git a/src/it/test1/src/main/scala/MyClass.scala b/src/it/test1/src/main/scala/MyClass.scala
new file mode 100644
index 0000000..55a17e5
--- /dev/null
+++ b/src/it/test1/src/main/scala/MyClass.scala
@@ -0,0 +1,6 @@
+class MyClass {
+}
+
+//Companion Class
+object MyClass {
+}
\ No newline at end of file
diff --git a/src/it/test1/validate.groovy b/src/it/test1/validate.groovy
new file mode 100644
index 0000000..18b6e58
--- /dev/null
+++ b/src/it/test1/validate.groovy
@@ -0,0 +1,21 @@
+try {
+
+def file = new File(basedir, 'target/classes/MyClass.class')
+assert file.exists()
+
+def file2 = new File(basedir, 'target/classes/MyClass$.class')
+assert file2.exists()
+
+def file3 = new File(basedir, 'target/classes/TestClass.class')
+assert file3.exists()
+
+def file4 = new File(basedir, 'target/site/scaladocs/MyClass.html')
+assert file4.exists()
+
+
+return true
+
+} catch(Throwable e) {
+ e.printStackTrace()
+ return false
+}
\ No newline at end of file
diff --git a/src/it/testJavaAndScala/invoker.properties b/src/it/testJavaAndScala/invoker.properties
new file mode 100644
index 0000000..bdba922
--- /dev/null
+++ b/src/it/testJavaAndScala/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=clean package
\ No newline at end of file
diff --git a/src/it/testJavaAndScala/pom.xml b/src/it/testJavaAndScala/pom.xml
new file mode 100644
index 0000000..87e51ef
--- /dev/null
+++ b/src/it/testJavaAndScala/pom.xml
@@ -0,0 +1,74 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.scala-tools.maven-scala-plugin</groupId>
+ <artifactId>testJavaAndScala</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Test for Java + Scala compilation</name>
+ <description>Test for Java + Scala compilation</description>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>2.7.2</version>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>scala-compile-first</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>scala-test-compile</id>
+ <phase>process-test-resources</phase>
+ <goals>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/src/it/testJavaAndScala/src/main/java/JavaClass.java b/src/it/testJavaAndScala/src/main/java/JavaClass.java
new file mode 100644
index 0000000..65e2dd7
--- /dev/null
+++ b/src/it/testJavaAndScala/src/main/java/JavaClass.java
@@ -0,0 +1,6 @@
+class JavaClass extends ScalaClass {
+ public static void main(String [] args) {
+ JavaClass test = new JavaClass();
+ test.abstractJavaMethod();
+ }
+}
\ No newline at end of file
diff --git a/src/it/testJavaAndScala/src/main/java/JavaInterface.java b/src/it/testJavaAndScala/src/main/java/JavaInterface.java
new file mode 100644
index 0000000..43baf6c
--- /dev/null
+++ b/src/it/testJavaAndScala/src/main/java/JavaInterface.java
@@ -0,0 +1,4 @@
+
+public interface JavaInterface {
+ public void abstractJavaMethod();
+}
\ No newline at end of file
diff --git a/src/it/testJavaAndScala/src/main/scala/ScalaClass.scala b/src/it/testJavaAndScala/src/main/scala/ScalaClass.scala
new file mode 100644
index 0000000..4634612
--- /dev/null
+++ b/src/it/testJavaAndScala/src/main/scala/ScalaClass.scala
@@ -0,0 +1,6 @@
+class ScalaClass extends JavaInterface {
+
+ override def abstractJavaMethod() : Unit = {
+ Console.println("Test")
+ }
+}
\ No newline at end of file
diff --git a/src/it/testJavaAndScala/validate.groovy b/src/it/testJavaAndScala/validate.groovy
new file mode 100644
index 0000000..98affda
--- /dev/null
+++ b/src/it/testJavaAndScala/validate.groovy
@@ -0,0 +1,18 @@
+try {
+
+def file = new File(basedir, 'target/classes/ScalaClass.class')
+assert file.exists()
+
+def file2 = new File(basedir, 'target/classes/JavaClass.class')
+assert file2.exists()
+
+def file3 = new File(basedir, 'target/classes/JavaInterface.class')
+assert file3.exists()
+
+
+return true
+
+} catch(Throwable e) {
+ e.printStackTrace()
+ return false
+}
\ No newline at end of file
diff --git a/src/it/testLotsofJavaFiles/invoker.properties b/src/it/testLotsofJavaFiles/invoker.properties
new file mode 100644
index 0000000..2b1497c
--- /dev/null
+++ b/src/it/testLotsofJavaFiles/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=clean compile
\ No newline at end of file
diff --git a/src/it/testLotsofJavaFiles/pom.xml b/src/it/testLotsofJavaFiles/pom.xml
new file mode 100644
index 0000000..901d07c
--- /dev/null
+++ b/src/it/testLotsofJavaFiles/pom.xml
@@ -0,0 +1,90 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.scala-tools.maven-scala-plugin</groupId>
+ <artifactId>testLotsofJavaFiles</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Test for Java + Scala compilation with too many files and non-forked execution</name>
+ <description>Test for Java + Scala compilation</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>${scala.version.lastrelease}</version>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>scala-compile-first</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>add-source</goal>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>scala-test-compile</id>
+ <phase>process-test-resources</phase>
+ <goals>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/src/it/testLotsofJavaFiles/setup.groovy b/src/it/testLotsofJavaFiles/setup.groovy
new file mode 100644
index 0000000..819c206
--- /dev/null
+++ b/src/it/testLotsofJavaFiles/setup.groovy
@@ -0,0 +1,25 @@
+
+
+def className = "TestJava"
+
+
+def makeJavaClass = { name ->
+ def file = new File(basedir, "/src/main/java/" + name + ".java");
+ if(!file.exists()) {
+ file.createNewFile();
+ file.withPrintWriter({ output ->
+ output.println("class " + name + " {}");
+ });
+ }
+}
+
+new File(basedir, "/src/main/java").mkdirs();
+
+makeJavaClass("TestJavaClass");
+
+(1..512).each({ value ->
+ makeJavaClass("TestJavaClass" + value);
+});
+
+assert true
+true
\ No newline at end of file
diff --git a/src/it/testLotsofJavaFiles/src/main/scala/ScalaClass.scala b/src/it/testLotsofJavaFiles/src/main/scala/ScalaClass.scala
new file mode 100644
index 0000000..89866c3
--- /dev/null
+++ b/src/it/testLotsofJavaFiles/src/main/scala/ScalaClass.scala
@@ -0,0 +1,6 @@
+class ScalaClass {
+
+ def abstractJavaMethod() : Unit = {
+ Console.println("Test")
+ }
+}
\ No newline at end of file
diff --git a/src/it/testLotsofJavaFiles/validate.groovy b/src/it/testLotsofJavaFiles/validate.groovy
new file mode 100644
index 0000000..7ae615d
--- /dev/null
+++ b/src/it/testLotsofJavaFiles/validate.groovy
@@ -0,0 +1 @@
+new File(basedir, 'target/classes/ScalaClass.class').exists()
diff --git a/src/it/testLotsofJavaFilesNoFork/invoker.properties b/src/it/testLotsofJavaFilesNoFork/invoker.properties
new file mode 100644
index 0000000..2b1497c
--- /dev/null
+++ b/src/it/testLotsofJavaFilesNoFork/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=clean compile
\ No newline at end of file
diff --git a/src/it/testLotsofJavaFilesNoFork/pom.xml b/src/it/testLotsofJavaFilesNoFork/pom.xml
new file mode 100644
index 0000000..6f589f8
--- /dev/null
+++ b/src/it/testLotsofJavaFilesNoFork/pom.xml
@@ -0,0 +1,97 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.scala-tools.maven-scala-plugin</groupId>
+ <artifactId>testLotsofJavaFilesNoFork</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Test for Java + Scala compilation with too many files and non-forked execution</name>
+ <description>Test for Java + Scala compilation</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>${scala.version.lastrelease}</version>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </repository>
+ <repository>
+ <id>snapshots.scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-snapshots</url>
+ <snapshots><enabled>true</enabled></snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>scala-compile-first</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>add-source</goal>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>scala-test-compile</id>
+ <phase>process-test-resources</phase>
+ <goals>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <fork>false</fork>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/src/it/testLotsofJavaFilesNoFork/setup.groovy b/src/it/testLotsofJavaFilesNoFork/setup.groovy
new file mode 100644
index 0000000..819c206
--- /dev/null
+++ b/src/it/testLotsofJavaFilesNoFork/setup.groovy
@@ -0,0 +1,25 @@
+
+
+def className = "TestJava"
+
+
+def makeJavaClass = { name ->
+ def file = new File(basedir, "/src/main/java/" + name + ".java");
+ if(!file.exists()) {
+ file.createNewFile();
+ file.withPrintWriter({ output ->
+ output.println("class " + name + " {}");
+ });
+ }
+}
+
+new File(basedir, "/src/main/java").mkdirs();
+
+makeJavaClass("TestJavaClass");
+
+(1..512).each({ value ->
+ makeJavaClass("TestJavaClass" + value);
+});
+
+assert true
+true
\ No newline at end of file
diff --git a/src/it/testLotsofJavaFilesNoFork/src/main/scala/ScalaClass.scala b/src/it/testLotsofJavaFilesNoFork/src/main/scala/ScalaClass.scala
new file mode 100644
index 0000000..89866c3
--- /dev/null
+++ b/src/it/testLotsofJavaFilesNoFork/src/main/scala/ScalaClass.scala
@@ -0,0 +1,6 @@
+class ScalaClass {
+
+ def abstractJavaMethod() : Unit = {
+ Console.println("Test")
+ }
+}
\ No newline at end of file
diff --git a/src/it/testLotsofJavaFilesNoFork/validate.groovy b/src/it/testLotsofJavaFilesNoFork/validate.groovy
new file mode 100644
index 0000000..7ae615d
--- /dev/null
+++ b/src/it/testLotsofJavaFilesNoFork/validate.groovy
@@ -0,0 +1 @@
+new File(basedir, 'target/classes/ScalaClass.class').exists()
diff --git a/src/it/test_goal_doc/invoker.properties b/src/it/test_goal_doc/invoker.properties
new file mode 100644
index 0000000..e9f232a
--- /dev/null
+++ b/src/it/test_goal_doc/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=clean compile scala:doc
diff --git a/src/it/test_goal_doc/pom.xml b/src/it/test_goal_doc/pom.xml
new file mode 100644
index 0000000..ae7077b
--- /dev/null
+++ b/src/it/test_goal_doc/pom.xml
@@ -0,0 +1,65 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.scala-tools.maven-scala-plugin</groupId>
+ <artifactId>docTest</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Test scaladoc generation</name>
+ <description>Test compilation pulls version from dependency</description>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>${scala.version.lastrelease}</version>
+ </dependency>
+ </dependencies>
+
+ <organization>
+ <url>ANYTHING</url>
+ <name>ANYTHING</name>
+ </organization>
+ <repositories>
+ <repository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </pluginRepository>
+ </pluginRepositories>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>
diff --git a/src/it/test_goal_doc/src/main/java/TestClass.java b/src/it/test_goal_doc/src/main/java/TestClass.java
new file mode 100644
index 0000000..a48fb72
--- /dev/null
+++ b/src/it/test_goal_doc/src/main/java/TestClass.java
@@ -0,0 +1,4 @@
+
+class TestClass {
+
+}
\ No newline at end of file
diff --git a/src/it/test_goal_doc/src/main/scala/MyClass.scala b/src/it/test_goal_doc/src/main/scala/MyClass.scala
new file mode 100644
index 0000000..55a17e5
--- /dev/null
+++ b/src/it/test_goal_doc/src/main/scala/MyClass.scala
@@ -0,0 +1,6 @@
+class MyClass {
+}
+
+//Companion Class
+object MyClass {
+}
\ No newline at end of file
diff --git a/src/it/test_goal_doc/validate.groovy b/src/it/test_goal_doc/validate.groovy
new file mode 100644
index 0000000..18b6e58
--- /dev/null
+++ b/src/it/test_goal_doc/validate.groovy
@@ -0,0 +1,21 @@
+try {
+
+def file = new File(basedir, 'target/classes/MyClass.class')
+assert file.exists()
+
+def file2 = new File(basedir, 'target/classes/MyClass$.class')
+assert file2.exists()
+
+def file3 = new File(basedir, 'target/classes/TestClass.class')
+assert file3.exists()
+
+def file4 = new File(basedir, 'target/site/scaladocs/MyClass.html')
+assert file4.exists()
+
+
+return true
+
+} catch(Throwable e) {
+ e.printStackTrace()
+ return false
+}
\ No newline at end of file
diff --git a/src/it/test_goal_site/invoker.properties b/src/it/test_goal_site/invoker.properties
new file mode 100644
index 0000000..190b346
--- /dev/null
+++ b/src/it/test_goal_site/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=clean compile site
diff --git a/src/it/test_goal_site/pom.xml b/src/it/test_goal_site/pom.xml
new file mode 100644
index 0000000..e97d834
--- /dev/null
+++ b/src/it/test_goal_site/pom.xml
@@ -0,0 +1,66 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.scala-tools.maven-scala-plugin</groupId>
+ <artifactId>docTest</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Test scaladoc generation</name>
+ <description>Test compilation pulls version from dependency</description>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>${scala.version.lastrelease}</version>
+ </dependency>
+ </dependencies>
+
+ <url>http://sandbox/</url>
+ <organization>
+ <url>ANYTHING</url>
+ <name>ANYTHING</name>
+ </organization>
+ <repositories>
+ <repository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </pluginRepository>
+ </pluginRepositories>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>
diff --git a/src/it/test_goal_site/src/main/java/TestClass.java b/src/it/test_goal_site/src/main/java/TestClass.java
new file mode 100644
index 0000000..a48fb72
--- /dev/null
+++ b/src/it/test_goal_site/src/main/java/TestClass.java
@@ -0,0 +1,4 @@
+
+class TestClass {
+
+}
\ No newline at end of file
diff --git a/src/it/test_goal_site/src/main/scala/MyClass.scala b/src/it/test_goal_site/src/main/scala/MyClass.scala
new file mode 100644
index 0000000..55a17e5
--- /dev/null
+++ b/src/it/test_goal_site/src/main/scala/MyClass.scala
@@ -0,0 +1,6 @@
+class MyClass {
+}
+
+//Companion Class
+object MyClass {
+}
\ No newline at end of file
diff --git a/src/it/test_goal_site/validate.groovy b/src/it/test_goal_site/validate.groovy
new file mode 100644
index 0000000..18b6e58
--- /dev/null
+++ b/src/it/test_goal_site/validate.groovy
@@ -0,0 +1,21 @@
+try {
+
+def file = new File(basedir, 'target/classes/MyClass.class')
+assert file.exists()
+
+def file2 = new File(basedir, 'target/classes/MyClass$.class')
+assert file2.exists()
+
+def file3 = new File(basedir, 'target/classes/TestClass.class')
+assert file3.exists()
+
+def file4 = new File(basedir, 'target/site/scaladocs/MyClass.html')
+assert file4.exists()
+
+
+return true
+
+} catch(Throwable e) {
+ e.printStackTrace()
+ return false
+}
\ No newline at end of file
diff --git a/src/it/test_scaladoc2_onJavaScala/invoker.properties b/src/it/test_scaladoc2_onJavaScala/invoker.properties
new file mode 100644
index 0000000..e9f232a
--- /dev/null
+++ b/src/it/test_scaladoc2_onJavaScala/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=clean compile scala:doc
diff --git a/src/it/test_scaladoc2_onJavaScala/pom.xml b/src/it/test_scaladoc2_onJavaScala/pom.xml
new file mode 100644
index 0000000..e75afd7
--- /dev/null
+++ b/src/it/test_scaladoc2_onJavaScala/pom.xml
@@ -0,0 +1,131 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>scaladocTest</groupId>
+ <artifactId>scaladocTest</artifactId>
+ <name>scaladocTest</name>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <scala.version>2.8.0</scala.version>
+ </properties>
+
+ <repositories>
+ <!-- Scala -->
+ <repository>
+ <id>scala-tools.org</id>
+ <name>Scala-Tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </repository>
+
+ <!-- Scala Latest -->
+ <repository>
+ <id>scala-tools.org.snapshots</id>
+ <name>Scala Tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-snapshots</url>
+ <snapshots />
+ </repository>
+
+ <!-- Java.Net Maven2 Repo (Glassfish,JEE API) -->
+ <repository>
+ <id>maven2-repository.dev.java.net</id>
+ <name>Java.net Repository for Maven</name>
+ <url>http://download.java.net/maven/2/</url>
+ <layout>default</layout>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <!-- Scala -->
+ <pluginRepository>
+ <id>scala-tools.org</id>
+ <name>Scala-Tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </pluginRepository>
+
+ <!-- Latest Maven Scala Plugin -->
+ <pluginRepository>
+ <id>scala-tools.org</id>
+ <name>Scala-Tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-snapshots</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <!-- Scala language/library -->
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>${scala.version}</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <!--================= MAVEN SCALA PLUGIN =================-->
+ <!-- Compile Scala, make mix with Java possible -->
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <id>compile</id>
+ <phase>compile</phase>
+ <goals><goal>compile</goal></goals>
+ </execution>
+ <execution>
+ <id>test-compile</id>
+ <phase>test-compile</phase>
+ <goals><goal>testCompile</goal></goals>
+ </execution>
+ <execution>
+ <id>process-resources</id>
+ <phase>process-resources</phase>
+ <goals><goal>compile</goal></goals>
+ </execution>
+ </executions>
+ <configuration>
+ <launchers>
+ <launcher>
+ <id>myLauncher</id>
+ <mainClass>HelloScala</mainClass>
+ </launcher>
+ </launchers>
+ </configuration>
+ </plugin>
+
+ <!-- Compiler plugin enforces Java 1.6 compatibility -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <debug>true</debug>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <!--================= REPORTING =================-->
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
diff --git a/src/it/test_scaladoc2_onJavaScala/src/main/java/HelloJava.java b/src/it/test_scaladoc2_onJavaScala/src/main/java/HelloJava.java
new file mode 100644
index 0000000..58b76e0
--- /dev/null
+++ b/src/it/test_scaladoc2_onJavaScala/src/main/java/HelloJava.java
@@ -0,0 +1,6 @@
+public class HelloJava {
+ public void sayHello() {
+ System.out.println("Java says:Hello Scala!");
+ HelloScala.sayHello();
+ }
+}
\ No newline at end of file
diff --git a/src/it/test_scaladoc2_onJavaScala/src/main/scala/HelloScala.scala b/src/it/test_scaladoc2_onJavaScala/src/main/scala/HelloScala.scala
new file mode 100644
index 0000000..66b42fc
--- /dev/null
+++ b/src/it/test_scaladoc2_onJavaScala/src/main/scala/HelloScala.scala
@@ -0,0 +1,6 @@
+object HelloScala extends Application {
+ val hj = new HelloJava
+ hj.sayHello
+
+ def sayHello = println("Scala says: Hello Java!")
+}
\ No newline at end of file
diff --git a/src/it/test_scaladoc2_onJavaScala/validate.groovy b/src/it/test_scaladoc2_onJavaScala/validate.groovy
new file mode 100644
index 0000000..bb4bdfb
--- /dev/null
+++ b/src/it/test_scaladoc2_onJavaScala/validate.groovy
@@ -0,0 +1,15 @@
+try {
+
+assert new File(basedir, 'target/site/scaladocs/HelloJava.html').exists()
+assert new File(basedir, 'target/site/scaladocs/HelloJava$.html').exists()
+assert new File(basedir, 'target/site/scaladocs/HelloScala$.html').exists()
+assert new File(basedir, 'target/site/scaladocs/index.html').exists()
+//assert file4.exists()
+
+
+return true
+
+} catch(Throwable e) {
+ e.printStackTrace()
+ return false
+}
\ No newline at end of file
diff --git a/src/it/test_script_hello/invoker.properties b/src/it/test_script_hello/invoker.properties
new file mode 100644
index 0000000..22e306a
--- /dev/null
+++ b/src/it/test_script_hello/invoker.properties
@@ -0,0 +1 @@
+invoker.goals=clean generate-sources
diff --git a/src/it/test_script_hello/pom.xml b/src/it/test_script_hello/pom.xml
new file mode 100644
index 0000000..9b467b4
--- /dev/null
+++ b/src/it/test_script_hello/pom.xml
@@ -0,0 +1,64 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.scala-tools.maven-scala-plugin</groupId>
+ <artifactId>scriptTest</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Test script</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>2.8.0.RC6</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <id>generate-hello</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>script</goal>
+ </goals>
+ <configuration>
+ <scalaVersion>${scala.version}</scalaVersion>
+ <keepGeneratedScript>true</keepGeneratedScript>
+ <script>
+ <![CDATA[
+ println("hello from scala script constructor")
+
+ def run() {
+ import java.io.PrintWriter
+// import scala.collection.jcl.Conversions._
+
+ println("hello from scala script run method")
+ log.info( project("scala.version") )
+ val fo = new PrintWriter("target/hello.txt")
+ try {
+ fo.println(project.getArtifactId())
+// for( d <- project.getDependencies() ) {
+// fo.println (d.getArtifactId)
+// }
+ } finally {
+ fo.close()
+ }
+ }
+ ]]>
+ </script>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/it/test_script_hello/validate.groovy b/src/it/test_script_hello/validate.groovy
new file mode 100644
index 0000000..2a19813
--- /dev/null
+++ b/src/it/test_script_hello/validate.groovy
@@ -0,0 +1,13 @@
+try {
+
+def file = new File(basedir, 'target/hello.txt')
+assert file.exists()
+
+
+
+return true
+
+} catch(Throwable e) {
+ e.printStackTrace()
+ return false
+}
\ No newline at end of file
diff --git a/src/main/java/org_scala_tools_maven/AddSourceMojo.java b/src/main/java/org_scala_tools_maven/AddSourceMojo.java
new file mode 100644
index 0000000..d4b0d38
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven/AddSourceMojo.java
@@ -0,0 +1,60 @@
+package org_scala_tools_maven;
+
+import java.io.File;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Add more source directories to the POM.
+ *
+ * @executionStrategy always
+ * @goal add-source
+ * @phase initialize
+ * @requiresDirectInvocation false
+ */
+public class AddSourceMojo extends AbstractMojo {
+
+ /**
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ /**
+ * The directory in which scala source is found
+ *
+ * @parameter expression="${project.build.sourceDirectory}/../scala"
+ */
+ protected File sourceDir;
+
+ /**
+ * The directory in which testing scala source is found
+ *
+ * @parameter expression="${project.build.testSourceDirectory}/../scala"
+ */
+ protected File testSourceDir;
+
+ public void execute() throws MojoExecutionException {
+ try {
+ if (sourceDir != null) {
+ String path = sourceDir.getCanonicalPath();
+ if (!project.getCompileSourceRoots().contains(path)) {
+ getLog().info("Add Source directory: " + path);
+ project.addCompileSourceRoot(path);
+ }
+ }
+ if (testSourceDir != null) {
+ String path = testSourceDir.getCanonicalPath();
+ if (!project.getTestCompileSourceRoots().contains(path)) {
+ getLog().info("Add Test Source directory: " + path);
+ project.addTestCompileSourceRoot(path);
+ }
+ }
+ } catch(Exception exc) {
+ getLog().warn(exc);
+ }
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven/BasicArtifact.java b/src/main/java/org_scala_tools_maven/BasicArtifact.java
new file mode 100644
index 0000000..c2fb305
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven/BasicArtifact.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2007 scala-tools.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+package org_scala_tools_maven;
+
+public class BasicArtifact {
+ public String groupId;
+ public String artifactId;
+ public String version;
+
+ @Override
+ public String toString() {
+ return "BasicArtifact(" + groupId + "," + artifactId + "," + version + ")";
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven/Launcher.java b/src/main/java/org_scala_tools_maven/Launcher.java
new file mode 100644
index 0000000..09662c8
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven/Launcher.java
@@ -0,0 +1,21 @@
+package org_scala_tools_maven;
+
+public class Launcher {
+ protected String id;
+
+ protected String mainClass;
+
+ /**
+ * Jvm Arguments
+ *
+ * @parameter
+ */
+ protected String[] jvmArgs;
+
+ /**
+ * compiler additionnals arguments
+ *
+ * @parameter
+ */
+ protected String[] args;
+}
diff --git a/src/main/java/org_scala_tools_maven/ScalaCompileMojo.java b/src/main/java/org_scala_tools_maven/ScalaCompileMojo.java
new file mode 100644
index 0000000..fe9973f
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven/ScalaCompileMojo.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2007 scala-tools.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+ package org_scala_tools_maven;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.maven.model.Dependency;
+
+/**
+ * Compiles a directory of Scala source. Corresponds roughly to the compile goal
+ * of the maven-compiler-plugin
+ *
+ * @phase compile
+ * @goal compile
+ * @requiresDependencyResolution compile
+ */
+public class ScalaCompileMojo extends ScalaCompilerSupport {
+
+ /**
+ * The directory in which to place compilation output
+ *
+ * @parameter expression="${project.build.outputDirectory}"
+ */
+ protected File outputDir;
+
+ /**
+ * The directory which contains scala/java source files
+ *
+ * @parameter expression="${project.build.sourceDirectory}/../scala"
+ */
+ protected File sourceDir;
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected List<File> getSourceDirectories() throws Exception {
+ List<String> sources = project.getCompileSourceRoots();
+ //Quick fix in case the user has not added the "add-source" goal.
+ String scalaSourceDir = sourceDir.getCanonicalPath();
+ if(!sources.contains(scalaSourceDir)) {
+ sources.add(scalaSourceDir);
+ }
+ return normalize(sources);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected List<String> getClasspathElements() throws Exception {
+ return TychoUtilities.addOsgiClasspathElements(project, project.getCompileClasspathElements());
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected List<Dependency> getDependencies() {
+ return project.getCompileDependencies();
+ }
+
+ @Override
+ protected File getOutputDir() throws Exception {
+ return outputDir.getAbsoluteFile();
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven/ScalaCompilerSupport.java b/src/main/java/org_scala_tools_maven/ScalaCompilerSupport.java
new file mode 100644
index 0000000..92551ca
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven/ScalaCompilerSupport.java
@@ -0,0 +1,218 @@
+/*
+ * Copyright 2007 scala-tools.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+package org_scala_tools_maven;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.codehaus.plexus.util.FileUtils;
+import org_scala_tools_maven_executions.JavaMainCaller;
+import org_scala_tools_maven_executions.MainHelper;
+
+/**
+ * Abstract parent of all Scala Mojo who run compilation
+ */
+public abstract class ScalaCompilerSupport extends ScalaSourceMojoSupport {
+
+ public static final String ALL = "all";
+ public static final String MODIFIED_ONLY = "modified-only";
+
+ /**
+ * Keeps track of if we get compile errors in incremental mode
+ */
+ private boolean compileErrors;
+
+
+ /**
+ * Pause duration between to scan to detect changed file to compile.
+ * Used only if compileInLoop or testCompileInLoop is true.
+ */
+ protected long loopSleep = 2500;
+
+ /**
+ * compilation-mode to use when sources was previously compiled and there is at least one change:
+ * "modified-only" => only modified source was recompiled (pre 2.13 behavior), "all" => every source are recompiled
+ * @parameter expression="${recompilation-mode}" default-value="all"
+ */
+ private String recompileMode = ALL;
+
+ /**
+ * notifyCompilation if true then print a message "path: compiling"
+ * for each root directory or files that will be compiled.
+ * Usefull for debug, and for integration with Editor/IDE to reset markers only for compiled files.
+ *
+ * @parameter expression="${notifyCompilation}" default-value="true"
+ */
+ private boolean notifyCompilation = true;
+
+ abstract protected File getOutputDir() throws Exception;
+
+ abstract protected List<String> getClasspathElements() throws Exception;
+
+ private long _lastCompileAt = -1;
+
+ @Override
+ protected void doExecute() throws Exception {
+ File outputDir = normalize(getOutputDir());
+ if (!outputDir.exists()) {
+ outputDir.mkdirs();
+ }
+ if (getLog().isDebugEnabled()) {
+ for(File directory : getSourceDirectories()) {
+ getLog().debug(directory.getCanonicalPath());
+ }
+ }
+ int nbFiles = compile(getSourceDirectories(), outputDir, getClasspathElements(), false);
+ switch (nbFiles) {
+ case -1:
+ getLog().warn("No source files found.");
+ break;
+ case 0:
+ getLog().info("Nothing to compile - all classes are up to date");;
+ break;
+ default:
+ break;
+ }
+ }
+
+
+ protected int compile(File sourceDir, File outputDir, List<String> classpathElements, boolean compileInLoop) throws Exception, InterruptedException {
+ //getLog().warn("Using older form of compile");
+ return compile(Arrays.asList(sourceDir), outputDir, classpathElements, compileInLoop);
+ }
+
+ protected int compile(List<File> sourceRootDirs, File outputDir, List<String> classpathElements, boolean compileInLoop) throws Exception, InterruptedException {
+ long t0 = System.currentTimeMillis();
+ if (_lastCompileAt < 0) {
+ _lastCompileAt = findLastSuccessfullCompilation(outputDir);
+ }
+
+ List<File> files = getFilesToCompile(sourceRootDirs, _lastCompileAt);
+
+ if (files == null) {
+ return -1;
+ }
+
+ if (files.size() < 1) {
+ return 0;
+ }
+ long t1 = System.currentTimeMillis();
+ getLog().info(String.format("Compiling %d source files to %s at %d", files.size(), outputDir.getAbsolutePath(), t1));
+ JavaMainCaller jcmd = getScalaCommand();
+ jcmd.redirectToLog();
+ jcmd.addArgs("-classpath", MainHelper.toMultiPath(classpathElements));
+ jcmd.addArgs("-d", outputDir.getAbsolutePath());
+ //jcmd.addArgs("-sourcepath", sourceDir.getAbsolutePath());
+ for (File f : files) {
+ jcmd.addArgs(f.getAbsolutePath());
+ }
+ if (jcmd.run(displayCmd, !compileInLoop)) {
+ setLastSuccessfullCompilation(outputDir, t1);
+ }
+ else {
+ compileErrors = true;
+ }
+ getLog().info(String.format("prepare-compile in %d s", (t1 - t0) / 1000));
+ getLog().info(String.format("compile in %d s", (System.currentTimeMillis() - t1) / 1000));
+ _lastCompileAt = t1;
+ return files.size();
+ }
+
+
+ /**
+ * Returns true if the previous compile failed
+ */
+ protected boolean hasCompileErrors() {
+ return compileErrors;
+ }
+
+ protected void clearCompileErrors() {
+ compileErrors = false;
+ }
+
+ protected List<File> getFilesToCompile(List<File> sourceRootDirs, long lastSuccessfullCompileTime) throws Exception {
+ List<File> sourceFiles = findSourceWithFilters(sourceRootDirs);
+ if (sourceFiles.size() == 0) {
+ return null;
+ }
+
+ // filter uptodate
+ // filter is not applied to .java, because scalac failed to used existing .class for unmodified .java
+ // failed with "error while loading Xxx, class file '.../target/classes/.../Xxxx.class' is broken"
+ // (restore how it work in 2.11 and failed in 2.12)
+ //TODO a better behavior : if there is at least one .scala to compile then add all .java, if there is at least one .java then add all .scala (because we don't manage class dependency)
+ List<File> files = new ArrayList<File>(sourceFiles.size());
+ if (_lastCompileAt > 0 || (!ALL.equals(recompileMode) && (lastSuccessfullCompileTime > 0))) {
+ ArrayList<File> modifiedScalaFiles = new ArrayList<File>(sourceFiles.size());
+ ArrayList<File> modifiedJavaFiles = new ArrayList<File>(sourceFiles.size());
+ ArrayList<File> allJavaFiles = new ArrayList<File>(sourceFiles.size());
+ for (File f : sourceFiles) {
+ if (f.getName().endsWith(".java")) {
+ allJavaFiles.add(f);
+ }
+ if (f.lastModified() >= lastSuccessfullCompileTime) {
+ if (f.getName().endsWith(".java")) {
+ modifiedJavaFiles.add(f);
+ } else {
+ modifiedScalaFiles.add(f);
+ }
+ }
+ }
+ if ((modifiedScalaFiles.size() != 0) || (modifiedJavaFiles.size() != 0)) {
+ if ((modifiedScalaFiles.size() != 0) && MODIFIED_ONLY.equals(recompileMode)) {
+ files.addAll(allJavaFiles);
+ files.addAll(modifiedScalaFiles);
+ notifyCompilation(files);
+ } else {
+ files.addAll(sourceFiles);
+ notifyCompilation(sourceRootDirs);
+ }
+ }
+ } else {
+ files.addAll(sourceFiles);
+ notifyCompilation(sourceRootDirs);
+ }
+ return files;
+ }
+
+ private void notifyCompilation(List<File> files) throws Exception {
+ if (notifyCompilation) {
+ for (File f : files) {
+ getLog().info(String.format("%s:-1: info: compiling", f.getCanonicalPath()));
+ }
+ }
+ }
+
+ private long findLastSuccessfullCompilation(File outputDir) throws Exception {
+ long back = -1;
+ final File lastCompileAtFile = new File(outputDir + ".timestamp");
+ if (lastCompileAtFile.exists() && outputDir.exists() && (outputDir.list().length > 0)) {
+ back = lastCompileAtFile.lastModified();
+ }
+ return back;
+ }
+
+ private void setLastSuccessfullCompilation(File outputDir, long v) throws Exception {
+ final File lastCompileAtFile = new File(outputDir + ".timestamp");
+ if (lastCompileAtFile.exists()) {
+ } else {
+ FileUtils.fileWrite(lastCompileAtFile.getAbsolutePath(), ".");
+ }
+ lastCompileAtFile.setLastModified(v);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org_scala_tools_maven/ScalaConsoleMojo.java b/src/main/java/org_scala_tools_maven/ScalaConsoleMojo.java
new file mode 100644
index 0000000..d8525e2
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven/ScalaConsoleMojo.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2007 scala-tools.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+package org_scala_tools_maven;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org_scala_tools_maven_executions.JavaMainCaller;
+import org_scala_tools_maven_executions.JavaMainCallerInProcess;
+import org_scala_tools_maven_executions.MainHelper;
+
+/**
+ * Run the Scala console with all the classes of the projects (dependencies and builded)
+ *
+ * @goal console
+ * @requiresDependencyResolution test
+ * @inheritByDefault false
+ * @requiresDirectInvocation true
+ * @executionStrategy once-per-session
+ */
+public class ScalaConsoleMojo extends ScalaMojoSupport {
+
+ /**
+ * The console to run.
+ *
+ * @parameter expression="${mainConsole}" default-value="scala.tools.nsc.MainGenericRunner"
+ * @required
+ */
+ protected String mainConsole;
+
+ /**
+ * Add the test classpath (include classes from test directory), to the console's classpath ?
+ *
+ * @parameter expression="${maven.scala.console.useTestClasspath}" default-value="true"
+ * @required
+ */
+ protected boolean useTestClasspath;
+
+ /**
+ * Add the runtime classpath, to the console's classpath ?
+ *
+ * @parameter expression="${maven.scala.console.useRuntimeClasspath}" default-value="true"
+ * @required
+ */
+ protected boolean useRuntimeClasspath;
+
+ /**
+ * Path of the javaRebel jar. If this option is set then the console run
+ * with <a href="http://www.zeroturnaround.com/javarebel/">javarebel</a> enabled.
+ *
+ * @parameter expression="${javarebel.jar.path}"
+ */
+ protected File javaRebelPath;
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void doExecute() throws Exception {
+ //TODO - Many other paths uses the getScalaCommand()!!! We should try to use that as much as possibel to help maintainability.
+ String sv = findScalaVersion().toString();
+ Set<String> classpath = new HashSet<String>();
+ addToClasspath("org.scala-lang", "scala-compiler", sv, classpath);
+ addToClasspath("org.scala-lang", "scala-library", sv, classpath);
+ addToClasspath("jline", "jline", "0.9.94", classpath);
+ classpath.addAll(project.getCompileClasspathElements());
+ if (useTestClasspath) {
+ classpath.addAll(project.getTestClasspathElements());
+ }
+ if (useRuntimeClasspath) {
+ classpath.addAll(project.getRuntimeClasspathElements());
+ }
+ String classpathStr = MainHelper.toMultiPath(classpath.toArray(new String[classpath.size()]));
+ JavaMainCaller jcmd = null;
+ List<String> list = new ArrayList<String>(args != null ? args.length + 3 : 3);
+ if(args != null) {
+ for(String arg : args) {
+ list.add(arg);
+ }
+ }
+ list.add("-cp");
+ list.add(classpathStr);
+
+ if(fork) {
+ getLog().warn("maven-scala-plugin cannot fork scala console!! Running in process");
+ }
+
+ jcmd = new JavaMainCallerInProcess(this, mainConsole, classpathStr, jvmArgs, list.toArray(new String[list.size()]));
+ //We need to make sure compiler plugins are sent into the interpreter as well!
+ addCompilerPluginOptions(jcmd);
+ if (javaRebelPath != null) {
+ if (!javaRebelPath.exists()) {
+ getLog().warn("javaRevelPath '"+javaRebelPath.getCanonicalPath()+"' not found");
+ } else {
+ jcmd.addJvmArgs("-noverify", "-javaagent:" + javaRebelPath.getCanonicalPath());
+ }
+ }
+ jcmd.run(displayCmd);
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven/ScalaContinuousCompileMojo.java b/src/main/java/org_scala_tools_maven/ScalaContinuousCompileMojo.java
new file mode 100644
index 0000000..8f1c891
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven/ScalaContinuousCompileMojo.java
@@ -0,0 +1,207 @@
+/*
+ * Copyright 2007 scala-tools.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+package org_scala_tools_maven;
+
+import java.io.File;
+import java.util.List;
+
+import org.codehaus.plexus.util.FileUtils;
+import org_scala_tools_maven_executions.JavaMainCaller;
+
+/**
+ * Compile the main and test scala source directory in continuous (infinite loop). !! This is an util goal for commandline usage only (Do not use or call it in a pom) !!!
+ *
+ * @goal cc
+ * @requiresDependencyResolution test
+ */
+public class ScalaContinuousCompileMojo extends ScalaCompilerSupport {
+
+ /**
+ * The output directory for compilation.
+ *
+ * @parameter expression="${project.build.outputDirectory}"
+ */
+ protected File mainOutputDir;
+
+ /**
+ * The main directory containing scala source for compilation
+ *
+ * @parameter expression="${project.build.sourceDirectory}/../scala"
+ */
+ protected File mainSourceDir;
+
+ /**
+ * The directory to place test compilation output in
+ *
+ * @parameter expression="${project.build.testOutputDirectory}
+ */
+ protected File testOutputDir;
+
+ /**
+ * The directory containing test source for compilation
+ *
+ * @parameter expression="${project.build.testSourceDirectory}/../scala"
+ */
+ protected File testSourceDir;
+
+ /**
+ * Define if fsc should be used, else scalac is used.
+ * fsc => scala.tools.nsc.CompileClient, scalac => scala.tools.nsc.Main.
+ *
+ * @parameter expression="${fsc}" default-value="true"
+ */
+ protected boolean useFsc = true;
+
+ /**
+ * Define if cc should run once or in infinite loop. (useful for test or working with editor)
+ * @parameter expression="${once}" default-value="false"
+ */
+ protected boolean once = false;
+
+ /**
+ * Turns verbose output on.
+ *
+ * @parameter expression="${verbose}" default-value="false"
+ */
+ protected boolean verbose = false;
+
+ @Override
+ protected List<String> getClasspathElements() throws Exception {
+ throw new UnsupportedOperationException("USELESS");
+ }
+
+ @Override
+ protected File getOutputDir() throws Exception {
+ throw new UnsupportedOperationException("USELESS");
+ }
+
+ @Override
+ protected List<File> getSourceDirectories() throws Exception {
+ throw new UnsupportedOperationException("USELESS");
+ }
+ @Override
+ protected JavaMainCaller getScalaCommand() throws Exception {
+ JavaMainCaller jcmd = super.getScalaCommand();
+ if (useFsc && verbose) {
+ jcmd.addOption("-verbose", verbose);
+ }
+ return jcmd;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected final void doExecute() throws Exception {
+
+ mainOutputDir = normalize(mainOutputDir);
+ if (!mainOutputDir.exists()) {
+ mainOutputDir.mkdirs();
+ }
+ mainSourceDir = normalize(mainSourceDir);
+
+ testOutputDir = normalize(testOutputDir);
+ if (!testOutputDir.exists()) {
+ testOutputDir.mkdirs();
+ }
+ testSourceDir = normalize(testSourceDir);
+
+ if (useFsc) {
+ getLog().info("use fsc for compilation");
+ scalaClassName = "scala.tools.nsc.CompileClient";
+ if (!once) {
+ StopServer stopServer = new StopServer();
+ stopServer.run();
+ startNewCompileServer();
+ Runtime.getRuntime().addShutdownHook(stopServer);
+ } else {
+ startNewCompileServer();
+ }
+ }
+
+ getLog().info("wait for files to compile...");
+ do {
+ clearCompileErrors();
+
+ int nbFile = 0;
+ if (mainSourceDir.exists()) {
+ nbFile = compile(mainSourceDir, mainOutputDir, project.getCompileClasspathElements(), true);
+ // If there are no source files, the compile method returns -1. Thus, to make sure we
+ // still run the tests if there are test sources, reset nbFile to zero.
+ if (nbFile == -1)
+ nbFile = 0;
+ }
+ if (testSourceDir.exists()) {
+ nbFile += compile(testSourceDir, testOutputDir, project.getTestClasspathElements(), true);
+ }
+ if (nbFile > 0) {
+ if (!hasCompileErrors()) {
+ postCompileActions();
+ } else {
+ getLog().info("Not running test cases due to compile error");
+ }
+ }
+ if (!once) {
+ if (nbFile > 0) {
+ getLog().info("wait for files to compile...");
+ Thread.sleep(5000);
+ } else {
+ Thread.sleep(3000);
+ }
+ }
+ } while (!once);
+ }
+
+
+
+ /**
+ * Allows derived Mojos to do things after a compile has succesfully completed such as run test cases
+ */
+ protected void postCompileActions() throws Exception {
+ }
+
+ private void startNewCompileServer() throws Exception {
+ File serverTagFile = new File(mainOutputDir + ".server");
+ if (serverTagFile.exists()) {
+ return;
+ }
+ getLog().info("start server...");
+ JavaMainCaller jcmd = getEmptyScalaCommand("scala.tools.nsc.MainGenericRunner");
+ jcmd.addArgs("scala.tools.nsc.CompileServer");
+ jcmd.addJvmArgs(jvmArgs);
+ jcmd.addArgs(args);
+ jcmd.spawn(displayCmd);
+ FileUtils.fileWrite(serverTagFile.getAbsolutePath(), ".");
+ Thread.sleep(1000); //HACK To wait startup time of server (avoid first fsc command to failed to contact server)
+ }
+
+ private class StopServer extends Thread {
+ @Override
+ public void run() {
+ try {
+ getLog().info("stop server(s)...");
+ JavaMainCaller jcmd = getScalaCommand();
+ jcmd.addArgs("-shutdown");
+ jcmd.run(displayCmd, false);
+ File serverTagFile = new File(mainOutputDir + ".server");
+ if (serverTagFile.exists()) {
+ serverTagFile.delete();
+ }
+ } catch (Exception exc) {
+ //getLog().warn(exc);
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/org_scala_tools_maven/ScalaContinuousTestMojo.java b/src/main/java/org_scala_tools_maven/ScalaContinuousTestMojo.java
new file mode 100644
index 0000000..c84f439
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven/ScalaContinuousTestMojo.java
@@ -0,0 +1,154 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org_scala_tools_maven;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.maven.BuildFailureException;
+import org.apache.maven.shared.invoker.CommandLineConfigurationException;
+import org.apache.maven.shared.invoker.DefaultInvocationRequest;
+import org.apache.maven.shared.invoker.InvocationRequest;
+import org.apache.maven.shared.invoker.Invoker;
+import org.apache.maven.shared.invoker.MavenCommandLineBuilder;
+import org.apache.maven.shared.invoker.MavenInvocationException;
+import org.apache.maven.shared.invoker.SystemOutHandler;
+
+/**
+ * Compile the main and test scala source directory then run unit test cases in continuous (infinite loop).
+ * This is an util goal for commandline usage only (Do not use or call it in a pom) !!!
+ *
+ * @version $Revision: 1.1 $
+ * @goal cctest
+ * @requiresDependencyResolution test
+ */
+
+public class ScalaContinuousTestMojo extends ScalaContinuousCompileMojo {
+
+ /**
+ * @component
+ */
+ protected Invoker invoker;
+
+
+ /**
+ * The local repository for caching artifacts. It is strongly recommended to specify a path to an isolated
+ * repository like <code>${project.build.directory}/it-repo</code>. Otherwise, your ordinary local repository will
+ * be used, potentially soiling it with broken artifacts.
+ *
+ * @parameter expression="${invoker.localRepositoryPath}" default-value="${settings.localRepository}"
+ */
+ protected File localRepositoryPath;
+
+ /**
+ * Specify this parameter to run individual tests by file name, overriding the <code>includes/excludes</code>
+ * parameters. Each pattern you specify here will be used to create an
+ * include pattern formatted like <code>**/${test}.java</code>, so you can just type "-Dtest=MyTest"
+ * to run a single test called "foo/MyTest.java". This parameter will override the TestNG suiteXmlFiles
+ * parameter.
+ *
+ * @parameter expression="${test}"
+ */
+ protected String test;
+
+ /**
+ * A space-separated list of the goals to execute as part of running the tests. You can use this
+ * setting to run different testing tools other than just JUnit. For example, to run the
+ * ScalaTest (with the maven-scalatest-plugin):
+ *
+ * <pre>
+ * mvn -Dcctest.goals=scalatest:test scala:cctest
+ * </pre>
+ *
+ * To run both ScalaTest and JUnit tests:
+ *
+ * <pre>
+ * mvn -Dcctest.goals="surefire:test scalatest:test" scala:cctest
+ * </pre>
+ *
+ * If you need to specify the goal every time you run <code>scala:cctest</code>, you can
+ * configure the setting in the pom.xml:
+ *
+ * <pre>
+ * <plugin>
+ * <groupId>org.scala-tools</groupId>
+ * <artifactId>maven-scala-plugin</artifactId>
+ * <version>2.15.1-SNAPSHOT</version>
+ * <configuration>
+ * <ccTestGoals>scalatest:test</ccTestGoals>
+ * </configuration>
+ * <!-- normal executions here -->
+ * </plugin>
+ * </pre>
+ *
+ * @parameter expression="${cctest.goals}" default-value="surefire:test"
+ */
+ protected String ccTestGoals;
+
+ @Override
+ protected void postCompileActions() throws Exception {
+ if (test == null) {
+ getLog().info("Now running all the unit tests. Use -Dtest=FooTest to run a single test by name");
+ }
+ else {
+ getLog().info("Now running tests matching: " + test);
+ }
+
+ final InvocationRequest request = new DefaultInvocationRequest();
+ request.setLocalRepositoryDirectory(localRepositoryPath);
+ request.setInteractive(false);
+ request.setErrorHandler(new SystemOutHandler(true));
+ request.setOutputHandler(new SystemOutHandler(true));
+ request.setBaseDirectory(project.getBasedir());
+ request.setPomFile(new File(project.getBasedir(), "pom.xml"));
+
+ request.setGoals(getMavenGoals());
+ request.setOffline(false);
+
+ if (test != null) {
+ Properties properties = new Properties();
+ properties.put("test", test);
+ request.setProperties(properties);
+ }
+
+
+ if (getLog().isDebugEnabled()) {
+ try {
+ getLog().debug("Executing: " + new MavenCommandLineBuilder().build(request));
+ }
+ catch (CommandLineConfigurationException e) {
+ getLog().debug("Failed to display command line: " + e.getMessage());
+ }
+ }
+
+ try {
+ invoker.execute(request);
+ }
+ catch (final MavenInvocationException e) {
+ getLog().debug("Error invoking Maven: " + e.getMessage(), e);
+ throw new BuildFailureException("Maven invocation failed. " + e.getMessage(), e);
+ }
+ }
+
+ protected List<String> getMavenGoals() {
+ getLog().debug("Running tests with goal(s): " + ccTestGoals);
+ return Arrays.asList(ccTestGoals.split(" "));
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven/ScalaDocMojo.java b/src/main/java/org_scala_tools_maven/ScalaDocMojo.java
new file mode 100644
index 0000000..73a3905
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven/ScalaDocMojo.java
@@ -0,0 +1,460 @@
+/*
+ * Copyright 2007 scala-tools.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+package org_scala_tools_maven;
+
+import java.io.File;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Locale;
+
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.reporting.MavenReport;
+import org.apache.maven.reporting.MavenReportException;
+import org.codehaus.doxia.sink.Sink;
+import org.codehaus.plexus.util.StringUtils;
+import org_scala_tools_maven_executions.JavaMainCaller;
+import org_scala_tools_maven_executions.MainHelper;
+
+/**
+ * Produces Scala API documentation.
+ *
+ * @goal doc
+ * @requiresDependencyResolution compile
+ * @execute phase="generate-sources"
+ */
+public class ScalaDocMojo extends ScalaSourceMojoSupport implements MavenReport {
+
+ /**
+ * Specify window title of generated HTML documentation.
+ * [scaladoc, vscaladoc]
+ *
+ * @parameter expression="${windowtitle}"
+ * default-value="${project.name} ${project.version} API"
+ */
+ protected String windowtitle;
+
+ /**
+ * Specifies the text to be placed at the bottom of each output file. If you
+ * want to use html you have to put it in a CDATA section, eg.
+ * <![CDATA[Copyright 2005, <a
+ * href="http://www.mycompany.com">MyCompany, Inc.<a>]]>
+ * [scaladoc, vscaladoc]
+ *
+ * @parameter expression="${bottom}"
+ * default-value="Copyright (c) {inceptionYear}-{currentYear} {organizationName}. All Rights Reserved."
+ */
+ protected String bottom;
+
+ /**
+ * Charset for cross-platform viewing of generated documentation.
+ * [scaladoc, vscaladoc]
+ *
+ * @parameter expression="${charset}" default-value="ISO-8859-1"
+ */
+ protected String charset;
+
+ /**
+ * Include title for the overview page.
+ * [scaladoc, scaladoc2, vscaladoc]
+ *
+ * @parameter expression="${doctitle}"
+ * default-value="${project.name} ${project.version} API"
+ */
+ protected String doctitle;
+
+ /**
+ * Include footer text for each page.
+ * [scaladoc, vscaladoc]
+ *
+ * @parameter expression="${footer}"
+ */
+ protected String footer;
+
+ /**
+ * Include header text for each page
+ * [scaladoc, vscaladoc]
+ *
+ * @parameter expression="${header}"
+ */
+ protected String header;
+
+ /**
+ * Generate source in HTML
+ * [scaladoc, vscaladoc]
+ *
+ * @parameter expression="${linksource}" default-value="true"
+ */
+ protected boolean linksource;
+
+ /**
+ * Suppress description and tags, generate only declarations
+ * [scaladoc, vscaladoc]
+ *
+ * @parameter expression="${nocomment}" default-value="false"
+ */
+ protected boolean nocomment;
+
+ /**
+ * File to change style of the generated documentation
+ * [scaladoc, vscaladoc]
+ *
+ * @parameter expression="${stylesheetfile}"
+ */
+ protected File stylesheetfile;
+
+ /**
+ * Include top text for each page
+ * [scaladoc, vscaladoc]
+ *
+ * @parameter expression="${top}"
+ */
+ protected String top;
+
+ /**
+ * Specifies the destination directory where scalaDoc saves the generated
+ * HTML files.
+ *
+ * @parameter expression="scaladocs"
+ * @required
+ */
+ private String outputDirectory;
+
+ /**
+ * Specifies the destination directory where javadoc saves the generated HTML files.
+ *
+ * @parameter expression="${project.reporting.outputDirectory}/scaladocs"
+ * @required
+ */
+ private File reportOutputDirectory;
+
+ /**
+ * The name of the Scaladoc report.
+ *
+ * @since 2.1
+ * @parameter expression="${name}" default-value="ScalaDocs"
+ */
+ private String name;
+
+ /**
+ * The description of the Scaladoc report.
+ *
+ * @since 2.1
+ * @parameter expression="${description}" default-value="ScalaDoc API
+ * documentation."
+ */
+ private String description;
+
+ /**
+ * className (FQN) of the main scaladoc to use, if not define, the the scalaClassName is used
+ *
+ * @parameter expression="${maven.scaladoc.className}"
+ */
+ protected String scaladocClassName;
+
+ /**
+ * If you want to use vscaladoc to generate api instead of regular scaladoc, set the version of vscaladoc you want to use.
+ *
+ * @parameter expression="${maven.scaladoc.vscaladocVersion}"
+ */
+ protected String vscaladocVersion;
+
+ /**
+ * To allow running aggregation only from command line use "-Dforce-aggregate=true" (avoid using in pom.xml).
+ * [scaladoc, vscaladoc]
+ *
+ * @parameter expression="${force-aggregate}" default-value="false"
+ */
+ protected boolean forceAggregate = false;
+
+ /**
+ * If you want to aggregate only direct sub modules.
+ *
+ * @parameter expression="${maven.scaladoc.aggregateDirectOnly}" default-value="true"
+ */
+ protected boolean aggregateDirectOnly = true;
+
+ /**
+ * The directory which contains scala/java source files
+ *
+ * @parameter expression="${project.build.sourceDirectory}/../scala"
+ */
+ protected File sourceDir;
+
+ private List<File> _sourceFiles;
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected List<File> getSourceDirectories() throws Exception {
+ List<String> sources = project.getCompileSourceRoots();
+ //Quick fix in case the user has not added the "add-source" goal.
+ String scalaSourceDir = sourceDir.getCanonicalPath();
+ if(!sources.contains(scalaSourceDir)) {
+ sources.add(scalaSourceDir);
+ }
+ return normalize(sources);
+ }
+
+ public boolean canGenerateReport() {
+ // there is modules to aggregate
+ boolean back = ((project.isExecutionRoot() || forceAggregate) && canAggregate() && project.getCollectedProjects().size() > 0);
+ back = back || (findSourceFiles().size() != 0);
+ return back;
+ }
+
+ /**
+ * @return
+ * @throws Exception
+ */
+ private List<File> findSourceFiles() {
+ if (_sourceFiles == null) {
+ try {
+ _sourceFiles = findSourceWithFilters();
+ } catch (Exception exc) {
+ throw new RuntimeException("can't define source to process", exc);
+ }
+ }
+ return _sourceFiles;
+ }
+
+ private boolean canAggregate() {
+ return StringUtils.isNotEmpty(vscaladocVersion) && (new VersionNumber(vscaladocVersion).compareTo(new VersionNumber("1.1")) >= 0);
+ }
+
+ public boolean isExternalReport() {
+ return true;
+ }
+
+ public String getCategoryName() {
+ return CATEGORY_PROJECT_REPORTS;
+ }
+
+ public String getDescription(@SuppressWarnings("unused") Locale locale) {
+ if (StringUtils.isEmpty(description)) {
+ return "ScalaDoc API documentation";
+ }
+ return description;
+ }
+
+ public String getName(@SuppressWarnings("unused") Locale locale) {
+ if (StringUtils.isEmpty(name)) {
+ return "ScalaDocs";
+ }
+ return name;
+ }
+
+ public String getOutputName() {
+ return outputDirectory + "/index";
+ }
+
+ public File getReportOutputDirectory() {
+ if (reportOutputDirectory == null) {
+ reportOutputDirectory = new File(project.getBasedir(), project.getReporting().getOutputDirectory() + "/" + outputDirectory).getAbsoluteFile();
+ }
+ return reportOutputDirectory;
+ }
+
+ public void setReportOutputDirectory(File v) {
+ if (v != null && outputDirectory != null && !v.getAbsolutePath().endsWith(outputDirectory)) {
+ this.reportOutputDirectory = new File(v, outputDirectory);
+ } else {
+ this.reportOutputDirectory = v;
+ }
+ }
+
+ @Override
+ public void doExecute() throws Exception {
+ // SiteRendererSink sink = siteRenderer.createSink(new
+ // File(project.getReporting().getOutputDirectory(), getOutputName() +
+ // ".html");
+ generate(null, Locale.getDefault());
+ }
+
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected JavaMainCaller getScalaCommand() throws Exception {
+ //This ensures we have a valid scala version...
+ checkScalaVersion();
+ boolean isPreviousScala271 = (new VersionNumber("2.7.1").compareTo(findScalaVersion()) > 0);
+ if (StringUtils.isEmpty(scaladocClassName)) {
+ if (!isPreviousScala271) {
+ scaladocClassName = "scala.tools.nsc.ScalaDoc";
+ } else {
+ scaladocClassName = scalaClassName;
+ }
+ }
+
+ JavaMainCaller jcmd = getEmptyScalaCommand(scaladocClassName);
+ jcmd.addArgs(args);
+ jcmd.addJvmArgs(jvmArgs);
+
+ if (isPreviousScala271){
+ jcmd.addArgs("-Ydoc");
+ }
+ List<String> paths = project.getCompileClasspathElements();
+ paths.remove(project.getBuild().getOutputDirectory()); //remove output to avoid "error for" : error: XXX is already defined as package XXX ... object XXX {
+ jcmd.addOption("-classpath", MainHelper.toMultiPath(paths));
+ //jcmd.addOption("-sourcepath", sourceDir.getAbsolutePath());
+
+ boolean isScaladoc2 = (new VersionNumber("2.8.0").compareTo(findScalaVersion()) <= 0) && ("scala.tools.nsc.ScalaDoc".equals(scaladocClassName));
+ if (isScaladoc2) {
+ jcmd.addArgs("-doc-format:html");
+ jcmd.addOption("-doc-title", doctitle);
+ } else {
+ jcmd.addOption("-bottom", getBottomText());
+ jcmd.addOption("-charset", charset);
+ jcmd.addOption("-doctitle", doctitle);
+ jcmd.addOption("-footer", footer);
+ jcmd.addOption("-header", header);
+ jcmd.addOption("-linksource", linksource);
+ jcmd.addOption("-nocomment", nocomment);
+ jcmd.addOption("-stylesheetfile", stylesheetfile);
+ jcmd.addOption("-top", top);
+ jcmd.addOption("-windowtitle", windowtitle);
+ }
+ return jcmd;
+ }
+
+ public void generate(@SuppressWarnings("unused") Sink sink, @SuppressWarnings("unused") Locale locale) throws MavenReportException {
+ try {
+ if (!canGenerateReport()) {
+ getLog().warn("No source files found");
+ return;
+ }
+
+ File reportOutputDir = getReportOutputDirectory();
+ if (!reportOutputDir.exists()) {
+ reportOutputDir.mkdirs();
+ }
+ if (StringUtils.isNotEmpty(vscaladocVersion)) {
+ scaladocClassName = "org.scala_tools.vscaladoc.Main";
+ BasicArtifact artifact = new BasicArtifact();
+ artifact.artifactId = "vscaladoc";
+ artifact.groupId = "org.scala-tools";
+ artifact.version = vscaladocVersion;
+ dependencies = new BasicArtifact[]{artifact};
+ }
+
+ List<File> sources = findSourceFiles();
+ if (sources.size() > 0) {
+ JavaMainCaller jcmd = getScalaCommand();
+ jcmd.addOption("-d", reportOutputDir.getAbsolutePath());
+ for (File x : sources) {
+ jcmd.addArgs(x.getCanonicalPath());
+ }
+ jcmd.run(displayCmd);
+ }
+ if (forceAggregate) {
+ aggregate(project);
+ } else {
+ // Mojo could not be run from parent after all its children
+ // So the aggregation will be run after the last child
+ tryAggregateUpper(project);
+ }
+
+ } catch (MavenReportException exc) {
+ throw exc;
+ } catch (RuntimeException exc) {
+ throw exc;
+ } catch (Exception exc) {
+ throw new MavenReportException("wrap: " + exc.getMessage(), exc);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void tryAggregateUpper(MavenProject prj) throws Exception {
+ if (prj != null && prj.hasParent() && canAggregate()) {
+ MavenProject parent = prj.getParent();
+ List<MavenProject> modules = parent.getCollectedProjects();
+ if ((modules.size() > 1) && prj.equals(modules.get(modules.size() - 1))) {
+ aggregate(parent);
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void aggregate(MavenProject parent) throws Exception {
+ List<MavenProject> modules = parent.getCollectedProjects();
+ File dest = new File(parent.getReporting().getOutputDirectory() +"/" + outputDirectory);
+ getLog().info("start aggregation into " + dest);
+ StringBuilder mpath = new StringBuilder();
+ for (MavenProject module : modules) {
+ if ( "pom".equals( module.getPackaging().toLowerCase() ) ) {
+ continue;
+ }
+ if (aggregateDirectOnly && module.getParent() != parent) {
+ continue;
+ }
+ File subScaladocPath = new File(module.getReporting().getOutputDirectory() +"/" + outputDirectory).getAbsoluteFile();
+ //System.out.println(" -> " + project.getModulePathAdjustment(module) +" // " + subScaladocPath + " // " + module.getBasedir() );
+ if (subScaladocPath.exists()) {
+ mpath.append(subScaladocPath).append(File.pathSeparatorChar);
+ }
+ }
+ if (mpath.length() != 0) {
+ getLog().info("aggregate vscaladoc from : " + mpath);
+ JavaMainCaller jcmd = getScalaCommand();
+ jcmd.addOption("-d", dest.getAbsolutePath());
+ jcmd.addOption("-aggregate", mpath.toString());
+ jcmd.run(displayCmd);
+ } else {
+ getLog().warn("no vscaladoc to aggregate");
+ }
+ tryAggregateUpper(parent);
+ }
+
+ /**
+ * Method that sets the bottom text that will be displayed on the bottom of
+ * the javadocs.
+ *
+ * @param inceptionYear the year when the project was started
+ * @return a String that contains the text that will be displayed at the
+ * bottom of the javadoc
+ */
+ private String getBottomText() {
+ String inceptionYear = project.getInceptionYear();
+ int actualYear = Calendar.getInstance().get(Calendar.YEAR);
+ String year = String.valueOf(actualYear);
+
+ String theBottom = StringUtils.replace(bottom, "{currentYear}", year);
+
+ if (inceptionYear != null) {
+ if (inceptionYear.equals(year)) {
+ theBottom = StringUtils.replace(theBottom, "{inceptionYear}-", "");
+ } else {
+ theBottom = StringUtils.replace(theBottom, "{inceptionYear}", inceptionYear);
+ }
+ } else {
+ theBottom = StringUtils.replace(theBottom, "{inceptionYear}-", "");
+ }
+
+ if (project.getOrganization() == null) {
+ theBottom = StringUtils.replace(theBottom, " {organizationName}", "");
+ } else {
+ if ((project.getOrganization() != null) && (StringUtils.isNotEmpty(project.getOrganization().getName()))) {
+ if (StringUtils.isNotEmpty(project.getOrganization().getUrl())) {
+ theBottom = StringUtils.replace(theBottom, "{organizationName}", "<a href=\"" + project.getOrganization().getUrl() + "\">" + project.getOrganization().getName() + "</a>");
+ } else {
+ theBottom = StringUtils.replace(theBottom, "{organizationName}", project.getOrganization().getName());
+ }
+ } else {
+ theBottom = StringUtils.replace(theBottom, " {organizationName}", "");
+ }
+ }
+
+ return theBottom;
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven/ScalaGenJsonMojo.java b/src/main/java/org_scala_tools_maven/ScalaGenJsonMojo.java
new file mode 100644
index 0000000..3d1b6e3
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven/ScalaGenJsonMojo.java
@@ -0,0 +1,303 @@
+/*
+ * Copyright 2007 scala-tools.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+package org_scala_tools_maven;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.License;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectHelper;
+import org.codehaus.jackson.JsonEncoding;
+import org.codehaus.jackson.JsonFactory;
+import org.codehaus.jackson.JsonGenerator;
+import org.codehaus.jackson.JsonNode;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.node.ObjectNode;
+import org.codehaus.plexus.util.StringUtils;
+import org_scala_tools_maven_executions.JavaMainCaller;
+
+import edu.emory.mathcs.backport.java.util.Arrays;
+
+/**
+ * Produces Scala API documentation in Json (use vscaladoc2_genjson).
+ *
+ * @goal genjson
+ * @requiresDependencyResolution compile
+ * @execute phase="generate-sources"
+ * @since 2.15.0
+ */
+public class ScalaGenJsonMojo extends ScalaSourceMojoSupport {
+
+ /**
+ * Define the html fragment for logo.
+ *
+ * @parameter expression="${genjson.logo}"
+ * default-value="<a href='${project.url}'>${project.name}</a>"
+ */
+ protected String logo;
+
+ /**
+ * Define the html fragment for license (default : use info of the first entry of pom.xml/project/licenses).
+ *
+ * @parameter expression="${genjson.license}"
+ */
+ protected String license;
+
+ /**
+ * Define the artifact's tags (space separator).
+ *
+ * @parameter expression="${genjson.tags}" default-value=""
+ */
+ protected String tags = "";
+
+ // /**
+ // * Generate source in HTML (not yet supported by vscaladoc2)
+ // *
+ // *
+ // * @parameter expression="${linksource}" default-value="true"
+ // */
+ // protected boolean linksource;
+
+ /**
+ * Define the html fragment for description (use in overview page).
+ *
+ * @parameter expression="${genjson.description}"
+ * default-value="${project.description}"
+ */
+ private String description;
+
+ /**
+ * Define the html fragment for description (use in overview page).
+ *
+ * @parameter expression="${genjson.linksources}"
+ * default-value=""
+ */
+ private String linksources;
+
+ /**
+ * Allow to override the artifactId used to generated json doc. Can be need sometimes (eg : for parent/group of projects)
+ *
+ * @parameter expression="${genjson.artifactId}"
+ * default-value="${project.artifactId}"
+ */
+ private String artifactId;
+
+ /**
+ * An optional json object as string used to override base configuration generated
+ * (useful for additional, not yet supported, entry)
+ *
+ * @parameter expression="${genjson.override}"
+ */
+ private String overrideJson;
+
+ /**
+ * Define the version of vscaladoc2_genjson to use.
+ *
+ * @parameter expression="${genjson.version}"
+ * default-value="0.3"
+ */
+ protected String vscaladoc2Version;
+
+ /**
+ * The directory which contains scala/java source files
+ *
+ * @parameter expression="${project.build.sourceDirectory}/../scala"
+ */
+ protected File sourceDir;
+
+ /**
+ * Maven ProjectHelper.
+ *
+ * @component
+ */
+ private MavenProjectHelper projectHelper;
+
+ protected String _mainClass = "net_alchim31_vscaladoc2_genjson.Main";
+ protected boolean _prettyPrint = true;
+
+ public ScalaGenJsonMojo() throws Exception {
+ super();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected List<File> getSourceDirectories() throws Exception {
+ List<String> sources = project.getCompileSourceRoots();
+ // Quick fix in case the user has not added the "add-source" goal.
+ String scalaSourceDir = sourceDir.getCanonicalPath();
+ if (!sources.contains(scalaSourceDir)) {
+ sources.add(scalaSourceDir);
+ }
+ return normalize(sources);
+ }
+
+ @Override
+ protected void doExecute() throws Exception {
+ if (StringUtils.isNotEmpty(_mainClass)) {
+ Cfg cfg = new Cfg(this);
+ File cfgFile = makeJsonCfg(cfg);
+ setDependenciesForJcmd();
+ JavaMainCaller jcmd = getEmptyScalaCommand(_mainClass);
+ jcmd.addJvmArgs(jvmArgs);
+ jcmd.addArgs(cfgFile.getCanonicalPath());
+ jcmd.run(displayCmd);
+ registerApidocArchiveForInstall(cfg);
+ } else {
+ getLog().warn("Not mainClass or valid launcher found/define");
+ }
+ }
+
+ private void setDependenciesForJcmd() {
+ BasicArtifact artifact = new BasicArtifact();
+ artifact.artifactId = "vscaladoc2_genjson";
+ artifact.groupId = "net.alchim31.vscaladoc2";
+ artifact.version = vscaladoc2Version;
+ dependencies = new BasicArtifact[] { artifact };
+ }
+
+ private void toJson(Object pojo, boolean prettyPrint, File f) throws Exception {
+ ObjectMapper m = new ObjectMapper();
+ JsonFactory jf = new JsonFactory();
+ JsonGenerator jg = jf.createJsonGenerator(f, JsonEncoding.UTF8);
+ if (prettyPrint) {
+ jg.useDefaultPrettyPrinter();
+ }
+ ObjectNode tree = m.valueToTree(pojo);
+
+ if (StringUtils.isNotEmpty(overrideJson)) {
+ JsonNode overrideTree = m.readValue(overrideJson, JsonNode.class);
+ Iterator<String> ks = overrideTree.getFieldNames();
+ while( ks.hasNext()) {
+ String k = ks.next();
+ JsonNode v = overrideTree.get(k);
+ tree.put(k, v);
+ }
+ }
+
+ m.writeTree(jg, tree);
+ }
+
+ private File makeJsonCfg(Cfg cfg) throws Exception {
+ initFilters();
+ File dir = new File(project.getBuild().getDirectory());
+ dir.mkdirs();
+ File f = new File(dir, "vscaladoc2_cfg.json");
+ toJson(cfg, _prettyPrint, f);
+ return f;
+ }
+
+ private void registerApidocArchiveForInstall(Cfg cfg) throws Exception {
+ File apidocArchiveFile = new File(System.getProperty("user.home"), ".config/vscaladoc2/apis/" + cfg.artifactId + "/" + cfg.version + "-apidoc.jar.gz").getCanonicalFile();
+ if (apidocArchiveFile.exists()) {
+ projectHelper.attachArtifact(project, "jar.gz", "apidoc", apidocArchiveFile);
+ } else {
+ getLog().warn("archive of apidoc not found : " + apidocArchiveFile);
+ }
+ }
+
+ protected static class Cfg {
+ public String groupId = "";
+ public String artifactId = "undef";
+ public String version = "0.0.0";
+ public String description = "";
+ public String logo = "";
+ public String license = "";
+ public String kind = "";
+ public String tags = "";
+ public String linksources = "";
+ public List<List<String>> dependencies = Collections.emptyList();
+ public List<List<Object>> sources = Collections.emptyList();
+ public List<String> artifacts = Collections.emptyList();
+ public List<String> additionnalArgs = Collections.emptyList();
+
+ @SuppressWarnings("unchecked")
+ protected Cfg(ScalaGenJsonMojo data) throws Exception {
+ groupId = data.project.getGroupId();
+ artifactId = data.artifactId;
+ version = data.project.getVersion();
+ logo = data.logo;
+ license = data.license;
+ description = data.description;
+ tags = data.tags;
+ linksources = data.linksources;
+ if (StringUtils.isBlank(license) && !data.project.getLicenses().isEmpty()) {
+ License lic = (License) data.project.getLicenses().get(0);
+ license = String.format("<a href='%s'>%s</a>", lic.getUrl(), lic.getName());
+ }
+ dependencies = makeDependencies(data);
+ sources = makeSources(data);
+ artifacts = makeArtifacts(data);
+ if (data.args != null && data.args.length > 0) {
+ additionnalArgs = Arrays.asList(data.args);
+ }
+ kind = makeKind(data);
+ }
+
+ private String makeKind(ScalaGenJsonMojo data) {
+ String back = null;
+ String pkg = data.project.getPackaging();
+ if ("pom".equals(pkg)) {
+ back = "group";
+ } else {
+ back = pkg;
+ }
+ return back;
+ }
+
+ protected List<List<String>> makeDependencies(ScalaGenJsonMojo data) throws Exception {
+ List<List<String>> back = new ArrayList<List<String>>();
+ @SuppressWarnings("unchecked")
+ List<Artifact> deps = data.project.getCompileArtifacts();
+ for (Artifact dep : deps) {
+ List<String> e = new ArrayList<String>(3);
+ e.add(dep.getFile().getCanonicalPath());
+ e.add(dep.getArtifactId() + "/" + dep.getVersion());
+ back.add(e);
+ }
+ return back;
+ }
+
+ protected List<List<Object>> makeSources(ScalaGenJsonMojo data) throws Exception {
+ List<List<Object>> back = new ArrayList<List<Object>>();
+ List<File> dirs = data.getSourceDirectories();
+ List<String> includes = new ArrayList<String>(data.includes);
+ List<String> excludes = new ArrayList<String>(data.excludes);
+ for (File dir : dirs) {
+ List<Object> e = new ArrayList<Object>(3);
+ e.add(dir.getCanonicalPath());
+ e.add(excludes);
+ e.add(includes);
+ back.add(e);
+ }
+ return back;
+ }
+
+ protected List<String> makeArtifacts(ScalaGenJsonMojo data) throws Exception {
+ List<String> back = new ArrayList<String>();
+ @SuppressWarnings("unchecked")
+ List<MavenProject> modules = data.project.getCollectedProjects();
+ for (MavenProject module : modules) {
+ back.add(module.getArtifactId() + "/" + module.getVersion());
+ }
+ return back;
+ }
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven/ScalaHelpMojo.java b/src/main/java/org_scala_tools_maven/ScalaHelpMojo.java
new file mode 100644
index 0000000..be0b037
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven/ScalaHelpMojo.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2007 scala-tools.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+package org_scala_tools_maven;
+
+import org_scala_tools_maven_executions.JavaMainCaller;
+
+
+/**
+ * Display the Scala Compiler help
+ *
+ * @goal help
+ */
+public class ScalaHelpMojo extends ScalaMojoSupport {
+ /**
+ * Determines if help will only display a version
+ * @parameter expression="${maven.scala.help.versionOnly}" default-value="false"
+ */
+ private boolean versionOnly;
+
+ @Override
+ public void doExecute() throws Exception {
+ JavaMainCaller jcmd = null;
+ if (!versionOnly) {
+ jcmd = getScalaCommand();
+ jcmd.addArgs("-help");
+ jcmd.addArgs("-X");
+ jcmd.addArgs("-Y");
+ jcmd.run(displayCmd);
+ }
+ jcmd = getScalaCommand();
+ jcmd.addArgs("-version");
+ jcmd.run(displayCmd);
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven/ScalaMojoSupport.java b/src/main/java/org_scala_tools_maven/ScalaMojoSupport.java
new file mode 100644
index 0000000..1d0360d
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven/ScalaMojoSupport.java
@@ -0,0 +1,561 @@
+/*
+ * Copyright 2007 scala-tools.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+package org_scala_tools_maven;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactCollector;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.project.artifact.InvalidDependencyVersionException;
+import org.apache.maven.shared.dependency.tree.DependencyNode;
+import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder;
+import org.apache.maven.shared.dependency.tree.filter.AncestorOrSelfDependencyNodeFilter;
+import org.apache.maven.shared.dependency.tree.filter.AndDependencyNodeFilter;
+import org.apache.maven.shared.dependency.tree.filter.DependencyNodeFilter;
+import org.apache.maven.shared.dependency.tree.traversal.CollectingDependencyNodeVisitor;
+import org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor;
+import org.apache.maven.shared.dependency.tree.traversal.FilteringDependencyNodeVisitor;
+import org.codehaus.plexus.util.StringUtils;
+import org_scala_tools_maven_dependency.CheckScalaVersionVisitor;
+import org_scala_tools_maven_dependency.ScalaDistroArtifactFilter;
+import org_scala_tools_maven_executions.JavaMainCaller;
+import org_scala_tools_maven_executions.JavaMainCallerByFork;
+import org_scala_tools_maven_executions.JavaMainCallerInProcess;
+import org_scala_tools_maven_executions.MainHelper;
+
+public abstract class ScalaMojoSupport extends AbstractMojo {
+
+ public static final String SCALA_GROUPID= "org.scala-lang";
+ public static final String SCALA_LIBRARY_ARTIFACTID= "scala-library";
+ /**
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ protected MavenProject project;
+
+ /**
+ * Used to look up Artifacts in the remote repository.
+ *
+ * @component
+ * @required
+ * @readonly
+ */
+ protected ArtifactFactory factory;
+
+ /**
+ * Used to look up Artifacts in the remote repository.
+ *
+ * @component
+ * @required
+ * @readonly
+ */
+ protected ArtifactResolver resolver;
+ /**
+ * Location of the local repository.
+ *
+ * @parameter expression="${localRepository}"
+ * @readonly
+ * @required
+ */
+ protected ArtifactRepository localRepo;
+
+ /**
+ * List of Remote Repositories used by the resolver
+ *
+ * @parameter expression="${project.remoteArtifactRepositories}"
+ * @readonly
+ * @required
+ */
+ protected List<?> remoteRepos;
+
+ /**
+ * Additional dependencies/jar to add to classpath to run "scalaClassName" (scope and optional field not supported)
+ * ex :
+ * <pre>
+ * <dependencies>
+ * <dependency>
+ * <groupId>org.scala-tools</groupId>
+ * <artifactId>scala-compiler-addon</artifactId>
+ * <version>1.0-SNAPSHOT</version>
+ * </dependency>
+ * </dependencies>
+ * </pre>
+ * @parameter
+ */
+ protected BasicArtifact[] dependencies;
+
+ /**
+ * Compiler plugin dependencies to use when compiling.
+ * ex:
+ * @parameter
+ * <xmp>
+ * <compilerPlugins>
+ * <compilerPlugin>
+ * <groupId>my.scala.plugin</groupId>
+ * <artifactId>amazingPlugin</artifactId>
+ * <version>1.0-SNAPSHOT</version>
+ * </compilerPlugin>
+ * </compilerPlugins>
+ * </xmp>
+ */
+ protected BasicArtifact[] compilerPlugins;
+
+ /**
+ * Jvm Arguments.
+ *
+ * @parameter
+ */
+ protected String[] jvmArgs;
+
+ /**
+ * compiler additionnals arguments
+ *
+ * @parameter
+ */
+ protected String[] args;
+
+ /**
+ * className (FQN) of the scala tool to provide as
+ *
+ * @required
+ * @parameter expression="${maven.scala.className}"
+ * default-value="scala.tools.nsc.Main"
+ */
+ protected String scalaClassName;
+
+ /**
+ * Scala 's version to use.
+ * (property 'maven.scala.version' replaced by 'scala.version')
+ *
+ * @parameter expression="${scala.version}"
+ */
+ private String scalaVersion;
+
+ /**
+ * Display the command line called ?
+ * (property 'maven.scala.displayCmd' replaced by 'displayCmd')
+ *
+ * @required
+ * @parameter expression="${displayCmd}"
+ * default-value="false"
+ */
+ public boolean displayCmd;
+
+ /**
+ * Forks the execution of scalac into a separate process.
+ *
+ * @parameter default-value="true"
+ */
+ protected boolean fork = true;
+
+ /**
+ * Force the use of an external ArgFile to run any forked process.
+ *
+ * @parameter default-value="false"
+ */
+ protected boolean forceUseArgFile = false;
+
+ /**
+ * Check if every dependencies use the same version of scala-library.
+ *
+ * @parameter expression="${maven.scala.checkConsistency}" default-value="true"
+ */
+ protected boolean checkMultipleScalaVersions;
+
+ /**
+ * Determines if a detection of multiple scala versions in the dependencies will cause the build to fail.
+ *
+ * @parameter default-value="false"
+ */
+ protected boolean failOnMultipleScalaVersions = false;
+ /**
+ * Artifact factory, needed to download source jars.
+ *
+ * @component
+ * @required
+ * @readonly
+ */
+ protected MavenProjectBuilder mavenProjectBuilder;
+
+ /**
+ * The artifact repository to use.
+ *
+ * @parameter expression="${localRepository}"
+ * @required
+ * @readonly
+ */
+ private ArtifactRepository localRepository;
+
+ /**
+ * The artifact factory to use.
+ *
+ * @component
+ * @required
+ * @readonly
+ */
+ private ArtifactFactory artifactFactory;
+
+ /**
+ * The artifact metadata source to use.
+ *
+ * @component
+ * @required
+ * @readonly
+ */
+ private ArtifactMetadataSource artifactMetadataSource;
+
+ /**
+ * The artifact collector to use.
+ *
+ * @component
+ * @required
+ * @readonly
+ */
+ private ArtifactCollector artifactCollector;
+
+ /**
+ * The dependency tree builder to use.
+ *
+ * @component
+ * @required
+ * @readonly
+ */
+ private DependencyTreeBuilder dependencyTreeBuilder;
+
+ private VersionNumber _scalaVersionN;
+
+ /**
+ * This method resolves the dependency artifacts from the project.
+ *
+ * @param theProject The POM.
+ * @return resolved set of dependency artifacts.
+ *
+ * @throws ArtifactResolutionException
+ * @throws ArtifactNotFoundException
+ * @throws InvalidDependencyVersionException
+ */
+ @SuppressWarnings("unchecked")
+ protected Set<Artifact> resolveDependencyArtifacts(MavenProject theProject) throws Exception {
+ AndArtifactFilter filter = new AndArtifactFilter();
+ filter.add(new ScopeArtifactFilter(Artifact.SCOPE_TEST));
+ filter.add(new ArtifactFilter(){
+ public boolean include(Artifact artifact) {
+ return !artifact.isOptional();
+ }
+ });
+ //TODO follow the dependenciesManagement and override rules
+ Set<Artifact> artifacts = theProject.createArtifacts(factory, Artifact.SCOPE_RUNTIME, filter);
+ for (Artifact artifact : artifacts) {
+ resolver.resolve(artifact, remoteRepos, localRepo);
+ }
+ return artifacts;
+ }
+
+ /**
+ * This method resolves all transitive dependencies of an artifact.
+ *
+ * @param artifact the artifact used to retrieve dependencies
+ *
+ * @return resolved set of dependencies
+ *
+ * @throws ArtifactResolutionException
+ * @throws ArtifactNotFoundException
+ * @throws ProjectBuildingException
+ * @throws InvalidDependencyVersionException
+ */
+ protected Set<Artifact> resolveArtifactDependencies(Artifact artifact) throws Exception {
+ Artifact pomArtifact = factory.createArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), "", "pom");
+ MavenProject pomProject = mavenProjectBuilder.buildFromRepository(pomArtifact, remoteRepos, localRepo);
+ return resolveDependencyArtifacts(pomProject);
+ }
+
+ public void addToClasspath(String groupId, String artifactId, String version, Set<String> classpath) throws Exception {
+ addToClasspath(groupId, artifactId, version, classpath, true);
+ }
+
+
+ public void addToClasspath(String groupId, String artifactId, String version, Set<String> classpath, boolean addDependencies) throws Exception {
+ addToClasspath(factory.createArtifact(groupId, artifactId, version, Artifact.SCOPE_RUNTIME, "jar"), classpath, addDependencies);
+ }
+
+ protected void addToClasspath(Artifact artifact, Set<String> classpath, boolean addDependencies) throws Exception {
+ resolver.resolve(artifact, remoteRepos, localRepo);
+ classpath.add(artifact.getFile().getCanonicalPath());
+ if (addDependencies) {
+ for (Artifact dep : resolveArtifactDependencies(artifact)) {
+ //classpath.add(dep.getFile().getCanonicalPath());
+ addToClasspath(dep, classpath, addDependencies);
+ }
+ }
+ }
+
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ try {
+ String oldWay = System.getProperty("maven.scala.version");
+ if (oldWay != null) {
+ getLog().warn("using 'maven.scala.version' is deprecated, use 'scala.version' instead");
+ if (scalaVersion != null) {
+ scalaVersion = oldWay;
+ }
+ }
+
+ oldWay = System.getProperty("maven.scala.displayCmd");
+ if (oldWay != null) {
+ getLog().warn("using 'maven.scala.displayCmd' is deprecated, use 'displayCmd' instead");
+ displayCmd = displayCmd || Boolean.parseBoolean(oldWay);
+ }
+ checkScalaVersion();
+ doExecute();
+ } catch (MojoExecutionException exc) {
+ throw exc;
+ } catch (MojoFailureException exc) {
+ throw exc;
+ } catch (RuntimeException exc) {
+ throw exc;
+ } catch (Exception exc) {
+ throw new MojoExecutionException("wrap: " + exc, exc);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ protected List<Dependency> getDependencies() {
+ return project.getCompileDependencies();
+ }
+
+ protected VersionNumber findScalaVersion() throws Exception {
+ if (_scalaVersionN == null) {
+ String detectedScalaVersion = scalaVersion;
+ if (StringUtils.isEmpty(detectedScalaVersion)) {
+ detectedScalaVersion = findScalaVersionFromDependencies();
+ }
+ if (StringUtils.isEmpty(detectedScalaVersion)) {
+ if (!"pom".equals( project.getPackaging().toLowerCase() )) {
+ getLog().warn("you don't define "+SCALA_GROUPID + ":" + SCALA_LIBRARY_ARTIFACTID + " as a dependency of the project");
+ }
+ detectedScalaVersion = "0.0.0";
+ } else {
+ // grappy hack to retrieve the SNAPSHOT version without timestamp,...
+ // because if version is -SNAPSHOT and artifact is deploy with uniqueValue then the version
+ // get from dependency is with the timestamp and a build number (the resolved version)
+ // but scala-compiler with the same version could have different resolved version (timestamp,...)
+ boolean isSnapshot = ArtifactUtils.isSnapshot(detectedScalaVersion);
+ if (isSnapshot && !detectedScalaVersion.endsWith("-SNAPSHOT")) {
+ detectedScalaVersion = detectedScalaVersion.substring(0, detectedScalaVersion.lastIndexOf('-', detectedScalaVersion.lastIndexOf('-')-1)) + "-SNAPSHOT";
+ }
+ }
+ if (StringUtils.isEmpty(detectedScalaVersion)) {
+ throw new MojoFailureException("no scalaVersion detected or set");
+ }
+ if (StringUtils.isNotEmpty(scalaVersion)) {
+ if (!scalaVersion.equals(detectedScalaVersion)) {
+ getLog().warn("scala library version define in dependencies doesn't match the scalaVersion of the plugin");
+ }
+ //getLog().info("suggestion: remove the scalaVersion from pom.xml"); //scalaVersion could be define in a parent pom where lib is not required
+ }
+ _scalaVersionN = new VersionNumber(detectedScalaVersion);
+ }
+ return _scalaVersionN;
+ }
+
+ //TODO refactor to do only one scan of dependency to find all scala-version
+ private String findScalaVersionFromDependencies() throws Exception {
+ String detectedScalaVersion = null;
+ for (Dependency dep : getDependencies()) {
+ if (SCALA_GROUPID.equals(dep.getGroupId()) && SCALA_LIBRARY_ARTIFACTID.equals(dep.getArtifactId())) {
+ detectedScalaVersion = dep.getVersion();
+ }
+ }
+ if (StringUtils.isEmpty(detectedScalaVersion)) {
+ List<Dependency> deps = new ArrayList<Dependency>();
+ deps.addAll(project.getModel().getDependencies());
+ if (project.getModel().getDependencyManagement() != null) {
+ deps.addAll(project.getModel().getDependencyManagement().getDependencies());
+ }
+ for (Dependency dep : deps) {
+ if (SCALA_GROUPID.equals(dep.getGroupId()) && SCALA_LIBRARY_ARTIFACTID.equals(dep.getArtifactId())) {
+ detectedScalaVersion = dep.getVersion();
+ }
+ }
+ }
+ return detectedScalaVersion;
+ }
+
+ protected void checkScalaVersion() throws Exception {
+ if (checkMultipleScalaVersions) {
+ checkCorrectVersionsOfScalaLibrary(findScalaVersion().toString());
+ }
+ }
+
+ /** this method checks to see if there are multiple versions of the scala library
+ * @throws Exception */
+ private void checkCorrectVersionsOfScalaLibrary(String requiredScalaVersion) throws Exception {
+ getLog().info("Checking for multiple versions of scala");
+ //TODO - Make sure we handle bad artifacts....
+ // TODO: note that filter does not get applied due to MNG-3236
+ checkArtifactForScalaVersion(requiredScalaVersion, dependencyTreeBuilder.buildDependencyTree( project, localRepository, artifactFactory,
+ artifactMetadataSource, null, artifactCollector ));
+ }
+
+
+ /** Visits a node (and all dependencies) to see if it contains duplicate scala versions */
+ private void checkArtifactForScalaVersion(String requiredScalaVersion, DependencyNode rootNode) throws Exception {
+ final CheckScalaVersionVisitor visitor = new CheckScalaVersionVisitor(requiredScalaVersion, getLog());
+
+ CollectingDependencyNodeVisitor collectingVisitor = new CollectingDependencyNodeVisitor();
+ DependencyNodeVisitor firstPassVisitor = new FilteringDependencyNodeVisitor( collectingVisitor, createScalaDistroDependencyFilter() );
+ rootNode.accept( firstPassVisitor );
+
+ DependencyNodeFilter secondPassFilter = new AncestorOrSelfDependencyNodeFilter( collectingVisitor.getNodes() );
+ DependencyNodeVisitor filteredVisitor = new FilteringDependencyNodeVisitor( visitor, secondPassFilter );
+
+ rootNode.accept( filteredVisitor );
+
+ if(visitor.isFailed()) {
+ visitor.logScalaDependents();
+ if(failOnMultipleScalaVersions) {
+ getLog().error("Multiple versions of scala libraries detected!");
+ throw new MojoFailureException("Multiple versions of scala libraries detected!");
+ }
+ getLog().warn("Multiple versions of scala libraries detected!");
+ }
+ }
+
+ /**
+ * @return
+ * A filter to only extract artifacts deployed from scala distributions
+ */
+ private DependencyNodeFilter createScalaDistroDependencyFilter() {
+ List<ArtifactFilter> filters = new ArrayList<ArtifactFilter>();
+ filters.add(new ScalaDistroArtifactFilter());
+ return new AndDependencyNodeFilter(filters);
+ }
+
+
+
+ protected abstract void doExecute() throws Exception;
+
+
+ protected JavaMainCaller getScalaCommand() throws Exception {
+ JavaMainCaller cmd = getEmptyScalaCommand(scalaClassName);
+ cmd.addArgs(args);
+ addCompilerPluginOptions(cmd);
+ cmd.addJvmArgs(jvmArgs);
+ return cmd;
+ }
+
+ protected JavaMainCaller getEmptyScalaCommand(String mainClass) throws Exception {
+ //TODO - Fork or not depending on configuration?
+ JavaMainCaller cmd;
+ if(fork) {
+ // scalac with args in files
+ // * works only since 2.8.0
+ // * is buggy (don't manage space in path on windows)
+ getLog().debug("use java command with args in file forced : " + forceUseArgFile);
+ cmd = new JavaMainCallerByFork(this, mainClass, getToolClasspath(), null, null, forceUseArgFile);
+ } else {
+ cmd = new JavaMainCallerInProcess(this, mainClass, getToolClasspath(), null, null);
+ }
+ cmd.addJvmArgs("-Xbootclasspath/a:"+ getBootClasspath());
+ return cmd;
+ }
+
+ private String getToolClasspath() throws Exception {
+ Set<String> classpath = new HashSet<String>();
+ addToClasspath(SCALA_GROUPID, "scala-compiler", findScalaVersion().toString(), classpath);
+// addToClasspath(SCALA_GROUPID, "scala-decoder", scalaVersion, classpath);
+// addToClasspath(SCALA_GROUPID, "scala-dbc", scalaVersion, classpath);
+ if (dependencies != null) {
+ for(BasicArtifact artifact: dependencies) {
+ addToClasspath(artifact.groupId, artifact.artifactId, artifact.version, classpath);
+ }
+ }
+ return MainHelper.toMultiPath(classpath.toArray(new String[classpath.size()]));
+ }
+
+ private String getBootClasspath() throws Exception {
+ Set<String> classpath = new HashSet<String>();
+ addToClasspath(SCALA_GROUPID, SCALA_LIBRARY_ARTIFACTID, findScalaVersion().toString(), classpath);
+ return MainHelper.toMultiPath(classpath.toArray(new String[classpath.size()]));
+ }
+
+ /**
+ * @return
+ * This returns whether or not the scala version can support having java sent into the compiler
+ */
+ protected boolean isJavaSupportedByCompiler() throws Exception {
+ return findScalaVersion().compareTo(new VersionNumber("2.7.2")) >= 0;
+ }
+
+
+ /**
+ * Adds appropriate compiler plugins to the scalac command.
+ * @param scalac
+ * @throws Exception
+ */
+ protected void addCompilerPluginOptions(JavaMainCaller scalac) throws Exception {
+ for (String plugin : getCompilerPlugins()) {
+ scalac.addArgs("-Xplugin:" + plugin);
+ }
+ }
+ /**
+ * Retrieves a list of paths to scala compiler plugins.
+ *
+ * @return The list of plugins
+ * @throws Exception
+ */
+ private Set<String> getCompilerPlugins() throws Exception {
+ Set<String> plugins = new HashSet<String>();
+ if (compilerPlugins != null) {
+ Set<String> ignoreClasspath = new HashSet<String>();
+ String sv = findScalaVersion().toString();
+ addToClasspath(SCALA_GROUPID, "scala-compiler", sv, ignoreClasspath);
+ addToClasspath(SCALA_GROUPID, SCALA_LIBRARY_ARTIFACTID, sv, ignoreClasspath);
+ for (BasicArtifact artifact : compilerPlugins) {
+ getLog().info("compiler plugin: " + artifact.toString());
+ // TODO - Ensure proper scala version for plugins
+ Set<String> pluginClassPath = new HashSet<String>();
+ //TODO - Pull in transitive dependencies.
+ addToClasspath(artifact.groupId, artifact.artifactId, artifact.version, pluginClassPath, false);
+ pluginClassPath.removeAll(ignoreClasspath);
+ plugins.addAll(pluginClassPath);
+ }
+ }
+ return plugins;
+ }
+
+
+}
diff --git a/src/main/java/org_scala_tools_maven/ScalaRunMojo.java b/src/main/java/org_scala_tools_maven/ScalaRunMojo.java
new file mode 100644
index 0000000..ea7d647
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven/ScalaRunMojo.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2007 scala-tools.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+package org_scala_tools_maven;
+
+import org.codehaus.plexus.util.StringUtils;
+import org_scala_tools_maven_executions.JavaMainCaller;
+import org_scala_tools_maven_executions.JavaMainCallerByFork;
+import org_scala_tools_maven_executions.MainHelper;
+
+
+/**
+ * Run a Scala class using the Scala runtime
+ *
+ * @goal run
+ * @requiresDependencyResolution test
+ * @execute phase="test-compile"
+ */
+public class ScalaRunMojo extends ScalaMojoSupport {
+
+ /**
+ * The class to use when launching a scala program
+ *
+ * @parameter expression="${launcher}"
+ */
+ protected String launcher;
+
+ /**
+ * Additional parameter to use to call the main class
+ * Using this parameter only from command line ("-DaddArgs=arg1|arg2|arg3|..."), not from pom.xml.
+ * @parameter expression="${addArgs}"
+ */
+ protected String addArgs;
+
+ /**
+ * A list of launcher definition (to avoid rewriting long command line or share way to call an application)
+ * launchers could be define by :
+ * <pre>
+ * <launchers>
+ * <launcher>
+ * <id>myLauncher</id>
+ * <mainClass>my.project.Main</mainClass>
+ * <args>
+ * <arg>arg1</arg>
+ * </args>
+ * <jvmArgs>
+ * <jvmArg>-Xmx64m</jvmArg>
+ * </jvmArgs>
+ * </launcher>
+ * <launcher>
+ * <id>myLauncher2</id>
+ * ...
+ * <><>
+ * </launcher>
+ * </launchers>
+ * </pre>
+ * @parameter
+ */
+ protected Launcher[] launchers;
+
+ /**
+ * Main class to call, the call use the jvmArgs and args define in the pom.xml, and the addArgs define in the command line if define.
+ *
+ * Higher priority to launcher parameter)
+ * Using this parameter only from command line (-DmainClass=...), not from pom.xml.
+ * @parameter expression="${mainClass}"
+ */
+ protected String mainClass;
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void doExecute() throws Exception {
+ JavaMainCaller jcmd = null;
+ if (StringUtils.isNotEmpty(mainClass)) {
+ jcmd = new JavaMainCallerByFork(this, mainClass, MainHelper.toMultiPath(project.getTestClasspathElements()), jvmArgs, args, forceUseArgFile);
+ } else if ((launchers != null) && (launchers.length > 0)) {
+ if (StringUtils.isNotEmpty(launcher)) {
+ for(int i = 0; (i < launchers.length) && (jcmd == null); i++) {
+ if (launcher.equals(launchers[i].id)) {
+ getLog().info("launcher '"+ launchers[i].id + "' selected => "+ launchers[i].mainClass );
+ jcmd = new JavaMainCallerByFork(this, launchers[i].mainClass, MainHelper.toMultiPath(project.getTestClasspathElements()), launchers[i].jvmArgs, launchers[i].args, forceUseArgFile);
+ }
+ }
+ } else {
+ getLog().info("launcher '"+ launchers[0].id + "' selected => "+ launchers[0].mainClass );
+ jcmd = new JavaMainCallerByFork(this, launchers[0].mainClass, MainHelper.toMultiPath(project.getTestClasspathElements()), launchers[0].jvmArgs, launchers[0].args, forceUseArgFile);
+ }
+ }
+ if (jcmd != null) {
+ if (StringUtils.isNotEmpty(addArgs)) {
+ jcmd.addArgs(StringUtils.split(addArgs, "|"));
+ }
+ jcmd.run(displayCmd);
+ } else {
+ getLog().warn("Not mainClass or valid launcher found/define");
+ }
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven/ScalaScriptMojo.java b/src/main/java/org_scala_tools_maven/ScalaScriptMojo.java
new file mode 100644
index 0000000..1506a98
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven/ScalaScriptMojo.java
@@ -0,0 +1,468 @@
+package org_scala_tools_maven;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.StringReader;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.StringUtils;
+import org_scala_tools_maven_executions.JavaMainCaller;
+import org_scala_tools_maven_executions.MainHelper;
+import org_scala_tools_maven_model.MavenProjectAdapter;
+
+
+/**
+ * Run a scala script.
+ *
+ * @goal script
+ * @requiresDependencyResolution runtime
+ * @executionStrategy always
+ * @since 2.7
+ */
+public class ScalaScriptMojo extends ScalaMojoSupport {
+
+ /*
+ * If the maven-scala-project is a dependency of the project then the
+ * MavenProject object describing the project will be passed to the script.
+ */
+
+ /**
+ * The build directory of the project
+ *
+ * @parameter expression="${project.build.directory}"
+ */
+ protected File outputDir;
+
+ /**
+ * The file containing script to be executed. Either '<em>scriptFile</em>'
+ * or '<em>script</em>' must be defined.
+ *
+ * @parameter expression="${scriptFile}"
+ */
+ protected File scriptFile;
+
+ /**
+ * The script that will be executed. Either '<em>scriptFile</em>' or '
+ * <em>script</em>' must be defined.
+ *
+ * @parameter expression="${script}"
+ */
+ protected String script;
+
+ /**
+ * If set to true the Scala classfile that is generated will not be deleted
+ * after the goal completes. This is to allows easier debugging of the
+ * script especially since line numbers will be wrong because lines are
+ * added to the compiled script (see script examples)
+ *
+ * @parameter expression="${maven.scala.keepGeneratedScript}"
+ * default-value="false"
+ */
+ protected boolean keepGeneratedScript;
+
+ /**
+ * Comma separated list of scopes to add to the classpath.
+ * The possible scopes are : test,compile, system, runtime, plugin.
+ * By default embedded script into pom.xml run with 'plugin' scope
+ * and script read from scriptFile run with 'compile, test, runtime'
+ *
+ * @parameter expression="${maven.scala.includeScopes}"
+ */
+ protected String includeScopes;
+
+ /**
+ * Comma separated list of scopes to remove from the classpath. Eg:
+ * test,compile
+ *
+ * @parameter expression="${maven.scala.excludeScopes}"
+ */
+ protected String excludeScopes;
+
+ /**
+ * Comma seperated list of directories or jars to add to the classpath
+ *
+ * @parameter expression="${addToClasspath}"
+ */
+ protected String addToClasspath;
+
+ /**
+ * Comma separated list of directories or jars to remove from the classpath.
+ * This is useful for resolving conflicts in the classpath. For example, the
+ * script uses Ant 1.7 and the compiler dependencies pull in Ant 1.5
+ * optional which conflicts and causes a crash
+ *
+ * @parameter expression="${removeFromClasspath}"
+ */
+ protected String removeFromClasspath;
+ /**
+ * The Maven Session Object
+ *
+ * @parameter expression="${session}"
+ * @required
+ * @readonly
+ */
+ protected MavenSession session;
+
+ private static int currentScriptIndex = 0;
+
+ @Override
+ protected void doExecute() throws Exception {
+ if (script == null && scriptFile == null) {
+ throw new MojoFailureException(
+ "Either script or scriptFile must be defined");
+ }
+ if (script != null && scriptFile != null) {
+ throw new MojoFailureException(
+ "Only one of script or scriptFile can be defined");
+ }
+ currentScriptIndex++;
+ if (StringUtils.isEmpty(includeScopes)) {
+ if (scriptFile != null) {
+ includeScopes = "compile, test, runtime";
+ } else {
+ includeScopes= Scopes.PLUGIN.name();
+ }
+ }
+
+ // prepare
+ File scriptDir = new File(outputDir, ".scalaScriptGen");
+ scriptDir.mkdirs();
+ File destFile = new File(scriptDir + "/" + scriptBaseName() + ".scala");
+
+ Set<String> classpath = new HashSet<String>();
+ configureClasspath(classpath);
+
+ URLClassLoader loader = createScriptClassloader(scriptDir, classpath);
+
+ boolean mavenProjectDependency = hasMavenProjectDependency(classpath);
+ wrapScript(destFile, mavenProjectDependency);
+
+ try {
+ compileScript(scriptDir, destFile, classpath);
+ runScript(mavenProjectDependency, loader);
+ } finally {
+ if (!keepGeneratedScript) {
+ delete(scriptDir);
+ }
+ }
+
+ }
+
+ private boolean hasMavenProjectDependency(Set<String> classpath)
+ throws MalformedURLException {
+ try {
+ List<URL> urls = new ArrayList<URL>();
+
+ // add the script directory to the classpath
+ for (String string : classpath) {
+ urls.add(new URL("file://" + string));
+ }
+
+ URLClassLoader loader = new URLClassLoader(urls
+ .toArray(new URL[urls.size()]));
+
+ loader.loadClass(MavenProjectAdapter.class.getCanonicalName());
+ return true;
+ } catch (ClassNotFoundException e) {
+ return false;
+ }
+ }
+
+ private void runScript(boolean mavenProjectDependency, URLClassLoader loader)
+ throws Exception {
+ Class<?> compiledScript = loader.loadClass(scriptBaseName());
+
+ try {
+ try {
+ Object instance;
+ if (mavenProjectDependency) {
+ Constructor<?> constructor = compiledScript.getConstructor(MavenProjectAdapter.class, MavenSession.class, Log.class);
+ instance = constructor.newInstance(new MavenProjectAdapter(project), session, getLog());
+ } else {
+ instance = compiledScript.newInstance();
+ }
+ try {
+ compiledScript.getMethod("run").invoke(instance);
+ } catch (NoSuchMethodException e) {
+ // ignore because if there is no method then its ok and we
+ // just
+ // don't run the method. initialization of the class must
+ // have been
+ // enough
+ }
+ } catch (InvocationTargetException e) {
+ if (e.getTargetException() != null) {
+ throw e.getTargetException();
+ } else if (e.getCause() != null) {
+ throw e.getCause();
+ } else {
+ throw e;
+ }
+ } catch (ExceptionInInitializerError e) {
+ if (e.getException() != null) {
+ throw e.getException();
+ } else if (e.getCause() != null) {
+ throw e.getCause();
+ } else {
+ throw e;
+ }
+ }
+ } catch (Throwable e) {
+ if (e instanceof Exception) {
+ throw (Exception) e;
+ }
+ throw new Exception("A " + e.getClass().getSimpleName() + " exception was thrown", e);
+ }
+ }
+
+ private URLClassLoader createScriptClassloader(File scriptDir,
+ Set<String> classpath) throws MalformedURLException {
+ List<URL> urls = new ArrayList<URL>();
+
+ // add the script directory to the classpath
+ urls.add(scriptDir.toURI().toURL());
+
+ for (String string : classpath) {
+ urls.add(new URL("file://" + string));
+ }
+
+ URLClassLoader loader = new URLClassLoader(urls.toArray(new URL[urls
+ .size()]), getClass().getClassLoader());
+ return loader;
+ }
+
+ private void compileScript(File scriptDir, File destFile,
+ Set<String> classpath) throws Exception {
+ JavaMainCaller jcmd = getScalaCommand();
+ jcmd.addArgs("-classpath", MainHelper.toMultiPath(new ArrayList<String>(classpath)));
+ jcmd.addArgs("-d", scriptDir.getAbsolutePath());
+ jcmd.addArgs("-sourcepath", scriptDir.getAbsolutePath());
+ jcmd.addArgs(destFile.getAbsolutePath());
+
+ jcmd.run(displayCmd);
+ }
+
+ private void configureClasspath(Set<String> classpath) throws Exception,
+ DependencyResolutionRequiredException {
+ MavenProjectAdapter projectAdapter = new MavenProjectAdapter(project);
+
+ Collection<Dependency> toInclude = new ArrayList<Dependency>();
+ if (includeScopes == null || includeScopes.length() == 0) {
+ getLog().warn("No scopes were included");
+ } else {
+
+ String[] include = includeScopes.split(",");
+ for (String string : include) {
+ Scopes scope = Scopes.lookup(string.toUpperCase());
+ if (scope != null) {
+ toInclude.addAll(scope.elements(projectAdapter));
+ } else {
+ getLog().warn(
+ "Included Scope: " + string + " is not one of: "
+ + Arrays.asList(Scopes.values()));
+ }
+ }
+ }
+ if (excludeScopes != null && excludeScopes.length() > 0) {
+
+ String[] exclude = excludeScopes.split(",");
+ for (String string : exclude) {
+ Scopes scope = Scopes.lookup(string.toUpperCase());
+ if (scope != null) {
+ toInclude.removeAll(scope.elements(projectAdapter));
+ } else {
+ getLog().warn(
+ "Excluded Scope: " + string + " is not one of: "
+ + Arrays.asList(Scopes.values()));
+ }
+ }
+ }
+
+ for (Dependency dependency : toInclude) {
+ addToClasspath(factory.createDependencyArtifact(dependency
+ .getGroupId(), dependency.getArtifactId(), VersionRange
+ .createFromVersion(dependency.getVersion()), dependency
+ .getType(), dependency.getClassifier(), dependency
+ .getScope(), dependency.isOptional()), classpath, true);
+ }
+
+
+
+ if (addToClasspath != null) {
+ classpath.addAll(Arrays.asList(addToClasspath.split(",")));
+ }
+
+ if (removeFromClasspath != null) {
+ ArrayList<String> toRemove = new ArrayList<String>();
+ String[] jars = removeFromClasspath.trim().split(",");
+ for (String string : classpath) {
+ for (String jar : jars) {
+ if (string.contains(jar.trim())) {
+ toRemove.add(string);
+ }
+ }
+ }
+ classpath.removeAll(toRemove);
+ }
+
+// String outputDirectory = project.getBuild().getOutputDirectory();
+// if(!outputDirectory.endsWith("/")){
+// // need it to end with / for URLClassloader
+// outputDirectory+="/";
+// }
+// classpath.add( outputDirectory);
+ String sv = findScalaVersion().toString();
+ addToClasspath("org.scala-lang", "scala-compiler", sv, classpath);
+ addToClasspath("org.scala-lang", "scala-library", sv, classpath);
+ //TODO check that every entry from the classpath exists !
+ boolean ok = true;
+ for (String s : classpath) {
+ File f = new File(s);
+ getLog().debug("classpath entry for running and compiling scripts: " + f);
+ if (!f.exists()) {
+ getLog().error("classpath entry for script not found : " + f);
+ ok = false;
+ }
+ }
+ if (!ok) {
+ throw new MojoFailureException("some script dependencies not found (see log)");
+ }
+ getLog().debug("Using the following classpath for running and compiling scripts: "+classpath);
+
+ }
+
+ private void wrapScript(File destFile, boolean mavenProjectDependency)
+ throws IOException {
+ destFile.delete();
+
+ FileOutputStream fileOutputStream = new FileOutputStream(destFile);
+ PrintStream out = new PrintStream(fileOutputStream);
+ try {
+ BufferedReader reader;
+ if (scriptFile != null) {
+ reader = new BufferedReader(new FileReader(scriptFile));
+ } else {
+ reader = new BufferedReader(new StringReader(script));
+ }
+
+ if (mavenProjectDependency) {
+// out.println("import scala.collection.jcl.Conversions._");
+ out.println("class " + scriptBaseName()
+ + "(project :" + MavenProjectAdapter.class.getCanonicalName()
+ + ",session :" + MavenSession.class.getCanonicalName()
+ + ",log :"+Log.class.getCanonicalName()
+ +") {"
+ );
+ } else {
+ out.println("class " + scriptBaseName() + " {");
+ }
+
+ String line = reader.readLine();
+ while (line != null) {
+ out.print(" ");
+ out.println(line);
+ line = reader.readLine();
+ }
+
+ out.println("}");
+ } finally {
+ out.close();
+ fileOutputStream.close();
+ }
+ }
+
+ private String scriptBaseName() {
+ if (scriptFile == null) {
+ return "embeddedScript_" + currentScriptIndex;
+ }
+ int dot = scriptFile.getName().lastIndexOf('.');
+ if (dot == -1) {
+ return scriptFile.getName() + "_" + currentScriptIndex;
+ }
+ return scriptFile.getName().substring(0, dot) + "_" + currentScriptIndex;
+ }
+
+ private void delete(File scriptDir) {
+ if (scriptDir.isDirectory()) {
+ for (File file : scriptDir.listFiles()) {
+ delete(file);
+ }
+ }
+
+ scriptDir.deleteOnExit();
+ scriptDir.delete();
+ }
+
+ private enum Scopes {
+ COMPILE {
+ @Override
+ public Collection<Dependency> elements(MavenProjectAdapter project) throws DependencyResolutionRequiredException {
+ return project.getCompileDependencies();
+ }
+ },
+ RUNTIME {
+ @Override
+ public Collection<Dependency> elements(MavenProjectAdapter project) throws DependencyResolutionRequiredException {
+ return project.getRuntimeDependencies();
+ }
+ },
+ TEST {
+ @Override
+ public Collection<Dependency> elements(MavenProjectAdapter project) throws DependencyResolutionRequiredException {
+ return project.getTestDependencies();
+ }
+ },
+ SYSTEM {
+ @Override
+ public Collection<Dependency> elements(MavenProjectAdapter project) throws DependencyResolutionRequiredException {
+ return project.getSystemDependencies();
+ }
+ },
+ PLUGIN {
+ @Override
+ public Collection<Dependency> elements(MavenProjectAdapter project) throws DependencyResolutionRequiredException {
+ Plugin me = (Plugin) project.getBuild().getPluginsAsMap().get("org.scala-tools:maven-scala-plugin");
+ Set<Dependency> back = new HashSet<Dependency>();
+ Dependency dep = new Dependency();
+ dep.setArtifactId(me.getArtifactId());
+ dep.setGroupId(me.getGroupId());
+ dep.setVersion(me.getVersion());
+ back.add(dep);
+ back.addAll((Collection<Dependency>) me.getDependencies());
+ return back;
+ }
+ };
+
+ public abstract Collection<Dependency> elements(MavenProjectAdapter project) throws DependencyResolutionRequiredException;
+
+ public static Scopes lookup(String name) {
+ for (Scopes scope : Scopes.values()) {
+ if (scope.name().trim().equalsIgnoreCase(name.trim())) {
+ return scope;
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven/ScalaSourceMojoSupport.java b/src/main/java/org_scala_tools_maven/ScalaSourceMojoSupport.java
new file mode 100644
index 0000000..799a903
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven/ScalaSourceMojoSupport.java
@@ -0,0 +1,141 @@
+/**
+ *
+ */
+package org_scala_tools_maven;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org_scala_tools_maven_executions.MainHelper;
+
+/**
+ * @author david.bernard
+ */
+abstract public class ScalaSourceMojoSupport extends ScalaMojoSupport {
+
+ /**
+ * Enables/Disables sending java source to the scala compiler.
+ *
+ * @parameter default-value="true"
+ */
+ protected boolean sendJavaToScalac = true;
+
+ /**
+ * A list of inclusion filters for the compiler.
+ * ex :
+ * <pre>
+ * <includes>
+ * <include>SomeFile.scala</include>
+ * </includes>
+ * </pre>
+ *
+ * @parameter
+ */
+ protected Set<String> includes = new HashSet<String>();
+
+ /**
+ * A list of exclusion filters for the compiler.
+ * ex :
+ * <pre>
+ * <excludes>
+ * <exclude>SomeBadFile.scala</exclude>
+ * </excludes>
+ * </pre>
+ *
+ * @parameter
+ */
+ protected Set<String> excludes = new HashSet<String>();
+
+ /**
+ * Retreives the list of *all* root source directories. We need to pass all .java and .scala files into the scala compiler
+ */
+ abstract protected List<File> getSourceDirectories() throws Exception;
+
+ private boolean _filterPrinted = false;
+
+ /**
+ * Finds all source files in a set of directories with a given extension.
+ */
+ protected List<File> findSourceWithFilters() throws Exception {
+ return findSourceWithFilters(getSourceDirectories());
+ }
+
+ protected void initFilters() throws Exception {
+ if (includes.isEmpty()) {
+ includes.add("**/*.scala");
+ if (sendJavaToScalac && isJavaSupportedByCompiler()) {
+ includes.add("**/*.java");
+ }
+ }
+ if (!_filterPrinted && getLog().isInfoEnabled()) {
+ StringBuilder builder = new StringBuilder("includes = [");
+ for (String include : includes) {
+ builder.append(include).append(",");
+ }
+ builder.append("]");
+ getLog().info(builder.toString());
+
+ builder = new StringBuilder("excludes = [");
+ for (String exclude : excludes) {
+ builder.append(exclude).append(",");
+ }
+ builder.append("]");
+ getLog().info(builder.toString());
+ _filterPrinted = true;
+ }
+ }
+
+ /**
+ * Finds all source files in a set of directories with a given extension.
+ */
+ protected List<File> findSourceWithFilters(List<File> sourceRootDirs) throws Exception {
+ List<File> sourceFiles = new ArrayList<File>();
+
+ initFilters();
+
+ // TODO - Since we're making files anyway, perhaps we should just test
+ // for existence here...
+ for (File dir : sourceRootDirs) {
+ String[] tmpFiles = MainHelper.findFiles(dir, includes.toArray(new String[includes.size()]), excludes.toArray(new String[excludes.size()]));
+ for (String tmpLocalFile : tmpFiles) {
+ File tmpAbsFile = normalize(new File(dir, tmpLocalFile));
+ sourceFiles.add(tmpAbsFile);
+ }
+ }
+ //scalac is sensible to scala file order, file system can't garanty file order => unreproductible build error across platform
+ // to garanty reproductible command line we order file by path (os dependend).
+ Collections.sort(sourceFiles);
+ return sourceFiles;
+ }
+
+ protected File normalize(File f) {
+ try {
+ f = f.getCanonicalFile();
+ } catch (IOException exc) {
+ f = f.getAbsoluteFile();
+ }
+ return f;
+ }
+
+ /**
+ * This limits the source directories to only those that exist for real.
+ */
+ protected List<File> normalize(List<String> compileSourceRootsList) {
+ List<File> newCompileSourceRootsList = new ArrayList<File>();
+ if (compileSourceRootsList != null) {
+ // copy as I may be modifying it
+ for (String srcDir : compileSourceRootsList) {
+ File srcDirFile = normalize(new File(srcDir));
+ if (!newCompileSourceRootsList.contains(srcDirFile) && srcDirFile.exists()) {
+ newCompileSourceRootsList.add(srcDirFile);
+ }
+ }
+ }
+ return newCompileSourceRootsList;
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven/ScalaTestCompileMojo.java b/src/main/java/org_scala_tools_maven/ScalaTestCompileMojo.java
new file mode 100644
index 0000000..9f7c0c7
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven/ScalaTestCompileMojo.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2007 scala-tools.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+package org_scala_tools_maven;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.maven.model.Dependency;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * Compile Scala test source into test-classes. Corresponds roughly to testCompile
+ * in maven-compiler-plugin
+ *
+ * @phase test-compile
+ * @goal testCompile
+ * @requiresDependencyResolution test
+ */
+public class ScalaTestCompileMojo extends ScalaCompilerSupport {
+
+ /**
+ * Set this to 'true' to bypass unit tests entirely.
+ * Its use is NOT RECOMMENDED, but quite convenient on occasion.
+ *
+ * @parameter expression="${maven.test.skip}"
+ */
+ protected boolean skip;
+
+ /**
+ * The directory in which to place test compilation output
+ *
+ * @parameter expression="${project.build.testOutputDirectory}
+ */
+ protected File testOutputDir;
+
+ /**
+ * The directory in which to find test scala source code
+ *
+ * @parameter expression="${project.build.testSourceDirectory}/../scala"
+ */
+ protected File testSourceDir;
+
+ @Override
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ if (skip) {
+ return;
+ }
+ super.execute();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected List<String> getClasspathElements() throws Exception {
+ return project.getTestClasspathElements();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected List<Dependency> getDependencies() {
+ return project.getTestDependencies();
+ }
+
+ @Override
+ protected File getOutputDir() throws Exception {
+ return testOutputDir.getAbsoluteFile();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected List<File> getSourceDirectories() throws Exception {
+ List<String> sources = project.getTestCompileSourceRoots();
+ String scalaSourceDir = testSourceDir.getAbsolutePath();
+ if(!sources.contains(scalaSourceDir)) {
+ sources.add(scalaSourceDir);
+ }
+ return normalize(sources);
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven/TychoUtilities.java b/src/main/java/org_scala_tools_maven/TychoUtilities.java
new file mode 100644
index 0000000..b5cb3c7
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven/TychoUtilities.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2007 scala-tools.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+package org_scala_tools_maven;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Grossly hacky utility class which provides the fully unpacked OSGi classpath
+ * (ie. including nested .jars) when used in the context of Tycho and Maven 3.
+ * The use of reflection is required to avoid wiring in a dependency on either
+ * Tycho or Maven 3.
+ *
+ * @author miles.sabin
+ */
+public class TychoUtilities {
+ private static final String TychoConstants_CTX_ECLIPSE_PLUGIN_CLASSPATH = "org.codehaus.tycho.TychoConstants/eclipsePluginClasspath";
+ private static final Method getContextValueMethod;
+ private static final Method getLocationsMethod;
+
+ static {
+ Method getContextValueMethod0 = null;
+ Method getLocationsMethod0 = null;
+ try {
+ final Class<?> mpClazz = MavenProject.class;
+ getContextValueMethod0 = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
+ public Method run() throws Exception {
+ Method m = mpClazz.getDeclaredMethod("getContextValue", String.class);
+ m.setAccessible(true);
+ return m;
+ }
+ });
+
+ final Class<?> cpeClazz = Class.forName("org.codehaus.tycho.ClasspathEntry");
+ getLocationsMethod0 = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
+ public Method run() throws Exception {
+ Method m = cpeClazz.getDeclaredMethod("getLocations");
+ m.setAccessible(true);
+ return m;
+ }
+ });
+ } catch (ClassNotFoundException ex) {
+ } catch (PrivilegedActionException ex) {
+ }
+ getContextValueMethod = getContextValueMethod0;
+ getLocationsMethod = getLocationsMethod0;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static List<String> addOsgiClasspathElements(MavenProject project, List<String> defaultClasspathElements) {
+ if (getLocationsMethod == null) {
+ return defaultClasspathElements;
+ }
+
+ List<Object> classpath = (List<Object>) getContextValue(project, TychoConstants_CTX_ECLIPSE_PLUGIN_CLASSPATH);
+ if (classpath == null || classpath.isEmpty())
+ return defaultClasspathElements;
+
+ List<String> osgiClasspath = new ArrayList<String>();
+ for (Object classpathEntry : classpath) {
+ for (File file : getLocations(classpathEntry))
+ osgiClasspath.add(file.getAbsolutePath());
+ }
+ osgiClasspath.addAll(defaultClasspathElements);
+ return osgiClasspath;
+ }
+
+ private static Object getContextValue(MavenProject project, String key) {
+ try {
+ return getContextValueMethod.invoke(project, key);
+ } catch (IllegalArgumentException e) {
+ return Collections.emptyList();
+ } catch (IllegalAccessException e) {
+ return Collections.emptyList();
+ } catch (InvocationTargetException e) {
+ return Collections.emptyList();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private static List<File> getLocations(Object classpathEntry) {
+ try {
+ return (List<File>) getLocationsMethod.invoke(classpathEntry);
+ } catch (IllegalArgumentException e) {
+ return Collections.emptyList();
+ } catch (IllegalAccessException e) {
+ return Collections.emptyList();
+ } catch (InvocationTargetException e) {
+ return Collections.emptyList();
+ }
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven/VersionNumber.java b/src/main/java/org_scala_tools_maven/VersionNumber.java
new file mode 100644
index 0000000..35ead89
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven/VersionNumber.java
@@ -0,0 +1,76 @@
+package org_scala_tools_maven;
+
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+
+public class VersionNumber /*implements Serializable*/ implements Comparable<VersionNumber>{
+ private static Pattern _regexp = Pattern.compile("(\\d+)\\.(\\d+)(\\.\\d+)?([-\\.]\\w+)?");
+
+ public int major;
+ public int minor;
+ public int bugfix;
+ public String modifier;
+
+ public VersionNumber(){
+ }
+
+ public VersionNumber(String s) {
+ Matcher match = _regexp.matcher(s);
+ if (!match.find()) {
+ throw new IllegalArgumentException("invalid versionNumber : major.minor(.bugfix)(modifier) :" + s);
+ }
+ major = Integer.parseInt(match.group(1));
+ minor = Integer.parseInt(match.group(2));
+ if ((match.group(3) != null) && (match.group(3).length() > 1)){
+ bugfix = Integer.parseInt(match.group(3).substring(1));
+ }
+ if ((match.group(4) != null) && (match.group(4).length() > 1)){
+ modifier = match.group(4);
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder str = new StringBuilder();
+ str.append(major)
+ .append('.')
+ .append(minor)
+ .append('.')
+ .append(bugfix)
+ ;
+ if ((modifier != null) && (modifier.length() > 0)){
+ str.append(modifier);
+ }
+ return str.toString();
+ }
+
+ /**
+ * Doesn't compare modifier
+ */
+ public int compareTo(VersionNumber o) {
+ int back = 0;
+ if ((back == 0) && (major > o.major)) {
+ back = 1;
+ }
+ if ((back == 0) && (major < o.major)) {
+ back = -1;
+ }
+ if ((back == 0) && (minor > o.minor)) {
+ back = 1;
+ }
+ if ((back == 0) && (minor < o.minor)) {
+ back = -1;
+ }
+ if ((back == 0) && (bugfix > o.bugfix)) {
+ back = 1;
+ }
+ if ((back == 0) && (bugfix < o.bugfix)) {
+ back = -1;
+ }
+ return back;
+ }
+
+
+}
diff --git a/src/main/java/org_scala_tools_maven_cs/ScalaCSCompileAllMojo.java b/src/main/java/org_scala_tools_maven_cs/ScalaCSCompileAllMojo.java
new file mode 100644
index 0000000..20917f9
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_cs/ScalaCSCompileAllMojo.java
@@ -0,0 +1,14 @@
+package org_scala_tools_maven_cs;
+
+
+/**
+ * Request compile to ScalaCS (no more, doesn't create project, check if exist, request compile of dependencies,...)
+ * @goal cs-compile-all
+ */
+public class ScalaCSCompileAllMojo extends ScalaCSMojoSupport {
+
+ @Override
+ protected CharSequence doRequest() throws Exception {
+ return scs.sendRequestCompile(null, true, true);
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven_cs/ScalaCSCompileMojo.java b/src/main/java/org_scala_tools_maven_cs/ScalaCSCompileMojo.java
new file mode 100644
index 0000000..953ae83
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_cs/ScalaCSCompileMojo.java
@@ -0,0 +1,14 @@
+package org_scala_tools_maven_cs;
+
+
+/**
+ * Request compile to ScalaCS (no more, doesn't create project, check if exist, request compile of dependencies,...)
+ * @goal cs-compile
+ */
+public class ScalaCSCompileMojo extends ScalaCSMojoSupport {
+
+ @Override
+ protected CharSequence doRequest() throws Exception {
+ return scs.sendRequestCompile(projectNamePattern(), true, true);
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven_cs/ScalaCSCompileSingleMojo.java b/src/main/java/org_scala_tools_maven_cs/ScalaCSCompileSingleMojo.java
new file mode 100644
index 0000000..3e3454b
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_cs/ScalaCSCompileSingleMojo.java
@@ -0,0 +1,14 @@
+package org_scala_tools_maven_cs;
+
+
+/**
+ * Request compile to ScalaCS (no more, doesn't create project, check if exist,...), but only the current project
+ * @goal cs-compile-single
+ */
+public class ScalaCSCompileSingleMojo extends ScalaCSMojoSupport {
+
+ @Override
+ protected CharSequence doRequest() throws Exception {
+ return scs.sendRequestCompile(projectNamePattern(), false, false);
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven_cs/ScalaCSInitMojo.java b/src/main/java/org_scala_tools_maven_cs/ScalaCSInitMojo.java
new file mode 100644
index 0000000..6fd2c63
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_cs/ScalaCSInitMojo.java
@@ -0,0 +1,171 @@
+package org_scala_tools_maven_cs;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.FileUtils;
+import org.yaml.snakeyaml.Yaml;
+
+/**
+ * Register the current project into running ScalaCS. If there is no running ScalaCS then install (if needed) and start it.
+ *
+ * @goal cs-init
+ * @requiresDependencyResolution test
+ */
+public class ScalaCSInitMojo extends ScalaCSMojoSupport {
+
+ /**
+ * The directory in which to place compilation output
+ *
+ * @parameter expression="${project.build.outputDirectory}"
+ */
+ protected File outputDir;
+
+ /**
+ * A list of inclusion filters for the compiler.
+ * ex :
+ * <pre>
+ * <includes>
+ * <include>SomeFile.scala</include>
+ * </includes>
+ * </pre>
+ *
+ * @parameter
+ */
+ private Set<String> includes = new HashSet<String>();
+
+ /**
+ * A list of exclusion filters for the compiler.
+ * ex :
+ * <pre>
+ * <excludes>
+ * <exclude>SomeBadFile.scala</exclude>
+ * </excludes>
+ * </pre>
+ *
+ * @parameter
+ */
+ private Set<String> excludes = new HashSet<String>();
+
+ /**
+ * The directory which contains scala/java source files
+ *
+ * @parameter expression="${project.build.sourceDirectory}/../scala"
+ */
+ protected File sourceDir;
+
+ /**
+ * The directory in which to place test compilation output
+ *
+ * @parameter expression="${project.build.testOutputDirectory}
+ */
+ protected File testOutputDir;
+
+ /**
+ * The directory in which to find test scala source code
+ *
+ * @parameter expression="${project.build.testSourceDirectory}/../scala"
+ */
+ protected File testSourceDir;
+
+ /**
+ * The directory in which to find test scala source code
+ *
+ * @parameter expression="${maven.scalacs.dumpYaml}" default-value="true"
+ */
+ protected boolean dumpYaml;
+
+ /**
+ * Should send a compilation request after initialization.
+ *
+ * @parameter expression="${maven.scalacs.compileAfterInit}" default-value="false"
+ */
+ protected boolean compileAfterInit;
+
+ @Override
+ protected CharSequence doRequest() throws Exception {
+ String yaml = toYaml(project).toString();
+ if (dumpYaml) {
+ new File(project.getBuild().getDirectory()).mkdirs();
+ FileUtils.fileWrite(project.getBuild().getDirectory() + "/project.yaml", "UTF-8", yaml);
+ }
+ StringBuilder back = new StringBuilder();
+ back.append(scs.sendRequestCreateOrUpdate(yaml));
+ if (compileAfterInit) {
+ back.append(scs.sendRequestCompile(project.getArtifactId()+"-"+project.getVersion(), true, true));
+ }
+ return back;
+ }
+
+ private CharSequence toYaml(MavenProject project) throws Exception {
+ HashMap<String, Object> dataCompile = new HashMap<String, Object>();
+ /*
+ name : sample
+ sourceDirs :
+ - "/home/dwayne/work/oss/scala-tools/scala-tools-server/src/main/scala"
+ includes :
+ - "*.scala"
+ excludes :
+ targetDir : "/home/dwayne/work/oss/scala-tools/scala-tools-server/target/classes"
+ classpath :
+ - "/home/dwayne/.m2/repository/org/scala-lang/scala-library/2.7.5/scala-library-2.7.5.jar"
+ - "/home/dwayne/.m2/repository/org/scala-lang/scala-compiler/2.7.5/scala-compiler-2.7.5.jar"
+ - "/home/dwayne/.m2/repository/org/jboss/netty/netty/3.1.0.GA/netty-3.1.0.GA.jar"
+ - "/home/dwayne/.m2/repository/SnakeYAML/SnakeYAML/1.3/SnakeYAML-1.3.jar"
+ args :
+ - "-deprecation"
+ */
+ dataCompile.put("name", project.getArtifactId()+"-"+project.getVersion()+"/main");
+ dataCompile.put("sourceDirs", getSourceDirectories());
+ if (includes != null) {
+ dataCompile.put("includes", new ArrayList<String>(includes));
+ }
+ if (excludes != null) {
+ dataCompile.put("excludes", new ArrayList<String>(excludes));
+ }
+ dataCompile.put("targetDir", outputDir.getCanonicalPath());
+ dataCompile.put("classpath", project.getCompileClasspathElements());
+ if (args != null) {
+ dataCompile.put("args", args);
+ }
+ dataCompile.put("exported", new File(localRepo.getBasedir() , localRepo.pathOf(project.getArtifact())).getCanonicalPath());
+
+ HashMap<String, Object> dataTest = new HashMap<String, Object>();
+ dataTest.put("name", project.getArtifactId()+"-"+project.getVersion() +"/test");
+ dataTest.put("sourceDirs", project.getTestCompileSourceRoots());
+ if (includes != null) {
+ dataTest.put("includes", new ArrayList<String>(includes));
+ }
+ if (excludes != null) {
+ dataTest.put("excludes", new ArrayList<String>(excludes));
+ }
+ dataTest.put("targetDir", testOutputDir.getCanonicalPath());
+ dataTest.put("classpath", project.getTestClasspathElements());
+ if (args != null) {
+ dataTest.put("args", args);
+ }
+
+ Yaml yaml = new Yaml();
+ List<HashMap<String, Object>> prjs = new LinkedList<HashMap<String, Object>>();
+ prjs.add(dataCompile);
+ prjs.add(dataTest);
+ return yaml.dumpAll(prjs.iterator());
+ }
+
+ @SuppressWarnings("unchecked")
+ protected List<String> getSourceDirectories() throws Exception {
+ List<String> sources = project.getCompileSourceRoots();
+ //Quick fix in case the user has not added the "add-source" goal.
+ String scalaSourceDir = sourceDir.getCanonicalPath();
+ if(!sources.contains(scalaSourceDir)) {
+ sources.add(scalaSourceDir);
+ }
+ return sources;
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven_cs/ScalaCSMojoSupport.java b/src/main/java/org_scala_tools_maven_cs/ScalaCSMojoSupport.java
new file mode 100644
index 0000000..f07c9ba
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_cs/ScalaCSMojoSupport.java
@@ -0,0 +1,49 @@
+package org_scala_tools_maven_cs;
+
+import org.apache.maven.plugin.MojoFailureException;
+
+import org_scala_tools_maven.ScalaMojoSupport;
+
+abstract public class ScalaCSMojoSupport extends ScalaMojoSupport {
+
+ /**
+ * If you want to use an other groupId of scalacs than the default one.
+ *
+ * @parameter expression="${scalacs.groupId}"
+ */
+ protected String csGroupId = "net.alchim31";
+
+ /**
+ * If you want to use an other artifactId of scalacs than the default one.
+ *
+ * @parameter expression="${scalacs.artifactId}"
+ */
+ protected String csArtifactId = "scalacs";
+
+ /**
+ * If you want to use an other version of scalacs than the default one.
+ *
+ * @parameter expression="${maven.scalacs.version}"
+ */
+ protected String csVersion = "0.2";
+
+ protected ScalacsClient scs;
+
+ @Override
+ final protected void doExecute() throws Exception {
+ scs = new ScalacsClient(this, csGroupId, csArtifactId, csVersion, jvmArgs);
+ String output = doRequest().toString();
+ //TODO use parser and maven logger to print (and find warning, error,...)
+ //TODO use Stream instead of String to allow progressive display (when scalacs will support it)
+ System.out.println(output);
+ if (output.contains("-ERROR")) {
+ throw new MojoFailureException("ScalaCS reply with ERRORs");
+ }
+ }
+
+ protected abstract CharSequence doRequest() throws Exception;
+
+ protected String projectNamePattern() throws Exception {
+ return project.getArtifactId() + "-" + project.getVersion() + "/.*";
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven_cs/ScalaCSRemoveMojo.java b/src/main/java/org_scala_tools_maven_cs/ScalaCSRemoveMojo.java
new file mode 100644
index 0000000..a47794f
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_cs/ScalaCSRemoveMojo.java
@@ -0,0 +1,14 @@
+package org_scala_tools_maven_cs;
+
+
+/**
+ * Request compile to ScalaCS (no more, doesn't create project, check if exist, request compile of dependencies,...)
+ * @goal cs-remove
+ */
+public class ScalaCSRemoveMojo extends ScalaCSMojoSupport {
+
+ @Override
+ protected CharSequence doRequest() throws Exception {
+ return scs.sendRequestRemove(projectNamePattern());
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven_cs/ScalaCSStopMojo.java b/src/main/java/org_scala_tools_maven_cs/ScalaCSStopMojo.java
new file mode 100644
index 0000000..7f7c9e5
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_cs/ScalaCSStopMojo.java
@@ -0,0 +1,14 @@
+package org_scala_tools_maven_cs;
+
+
+/**
+ * Request compile to ScalaCS (no more, doesn't create project, check if exist,...)
+ * @goal cs-stop
+ */
+public class ScalaCSStopMojo extends ScalaCSMojoSupport {
+
+ @Override
+ protected CharSequence doRequest() throws Exception {
+ return scs.sendRequestStop();
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven_cs/ScalacsClient.java b/src/main/java/org_scala_tools_maven_cs/ScalacsClient.java
new file mode 100644
index 0000000..80edd0d
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_cs/ScalacsClient.java
@@ -0,0 +1,337 @@
+package org_scala_tools_maven_cs;
+
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.RandomAccessFile;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.StringUtils;
+
+import org_scala_tools_maven.ScalaMojoSupport;
+import org_scala_tools_maven_executions.JavaMainCaller;
+import org_scala_tools_maven_executions.JavaMainCallerByFork;
+import org_scala_tools_maven_executions.MainHelper;
+import org_scala_tools_maven_executions.SpawnMonitor;
+
+/**
+ * ScalacsClient is a client used to send request to a scalacs running server.
+ *
+ * @author davidB
+ */
+public class ScalacsClient {
+ public static final String BOOT_PROP_RSRC = "scalacs.boot.properties";
+ public static Pattern linePattern = Pattern.compile("^-(INFO|WARN|ERROR)\t([^\t]*)\t([^\t]*)\t(.*)$");
+ public static Pattern locationPattern = Pattern.compile("([^#]*)#(\\d+),(\\d+),(\\d+),(\\d+)");
+
+ public enum Level {INFO, WARN, ERROR};
+
+ public static class LogEvent {
+ public Level level = Level.INFO;
+ public String category = "";
+ public File file = null;
+ public int line = 0;
+ public int column = 0;
+ public int offset = 0;
+ public int length = 0;
+ public CharSequence text = "";
+
+ @Override
+ public String toString() {
+ return level + "*" + category + "*" + file + "*" + line + "*" + column + "*" + offset + "*"+ length + "*"+ text+ "*";
+ }
+ }
+
+ private Log _log;
+ private ScalaMojoSupport _mojo;
+ private String[] _jvmArgs;
+ private String _csGroupId;
+ private String _csArtifactId;
+ private String _csVersion;
+
+ public ScalacsClient(ScalaMojoSupport mojo, String csGroupId, String csArtifactId, String csVersion, String[] jvmArgs) {
+ _log = mojo.getLog();
+ _mojo = mojo;
+ _csGroupId = csGroupId;
+ _csArtifactId = csArtifactId;
+ _csVersion = csVersion;
+ _jvmArgs = jvmArgs;
+ }
+
+ public List<LogEvent> parse(String response) throws Exception {
+ List<LogEvent> back = new LinkedList<LogEvent>();
+ BufferedReader in = new BufferedReader(new StringReader(response));
+ try {
+ for(String l = in.readLine(); l != null; l =in.readLine()){
+ Matcher m = linePattern.matcher(l);
+ if (m.matches()) {
+ LogEvent e = new LogEvent();
+ e.level = Level.valueOf(m.group(1).toUpperCase());
+ e.category = m.group(2);
+ e.text = m.group(4).replace('$', '\n');
+ Matcher ml = locationPattern.matcher(m.group(3));
+ if (ml.matches()) {
+ e.file = new File(ml.group(1));
+ e.line = Integer.parseInt(m.group(2));
+ e.column = Integer.parseInt(m.group(3));
+ e.offset = Integer.parseInt(m.group(4));
+ e.length = Integer.parseInt(m.group(5));
+ }
+ back.add(e);
+ }
+ }
+ } finally {
+ IOUtil.close(in);
+ }
+ return back;
+ }
+
+ /**
+ * request to createOrUpdate one or more project define in the Yaml syntax, each project definition should be separated by "---"
+ * @return the output (log) of the request
+ * @throws Exception
+ */
+ public String sendRequestCreateOrUpdate(String yamlDef) throws Exception {
+ String back = "";
+ try {
+ back = sendRequest("createOrUpdate", yamlDef);
+ } catch (java.net.ConnectException exc) {
+ startNewServer();
+ back = sendRequest("createOrUpdate", yamlDef);
+ }
+ return back;
+ }
+
+ /**
+ * @return the output (log) of the request
+ * @throws Exception
+ */
+ public String sendRequestRemove(String projectName) throws Exception {
+ return sendRequest("remove?p=" + projectName, null);
+ }
+
+ /**
+ *
+ * @return the output (log) of the request
+ * @throws Exception
+ */
+ public String sendRequestCompile(String projectName, boolean withDependencies, boolean withDependent) throws Exception {
+ StringBuilder query = new StringBuilder("compile");
+ if (StringUtils.isNotEmpty(projectName)) {
+ query.append("?p=").append(projectName);
+ if (!withDependencies) {
+ query.append("&noDependencies=true");
+ }
+ // not supported by scalacs 0.2
+ if (!withDependent) {
+ query.append("&noDependent=true");
+ }
+ }
+ return sendRequest(query.toString(), null);
+ }
+
+ /**
+ *
+ * @return the output (log) of the request
+ * @throws Exception
+ */
+ public String sendRequestClean() throws Exception {
+ return sendRequest("clean", null);
+ }
+
+ /**
+ *
+ * @return the output (log) of the request
+ * @throws Exception
+ */
+ public String sendRequestStop() throws Exception {
+ return sendRequest("stop", null);
+ }
+
+ protected String sendRequest(String action, String data) throws Exception {
+ URL url = new URL("http://127.0.0.1:27616/" + action);
+ traceUrl(url);
+ URLConnection cnx = url.openConnection();
+ cnx.setDoOutput(StringUtils.isNotEmpty(data));
+ cnx.setDoInput(true);
+ if (StringUtils.isNotEmpty(data)) {
+ OutputStream os = cnx.getOutputStream();
+ try {
+ IOUtil.copy(new StringReader(data), os);
+ } finally {
+ IOUtil.close(os);
+ }
+ }
+ InputStream is = cnx.getInputStream();
+ try {
+ String back = IOUtil.toString(is);
+ return back;
+ } finally {
+ IOUtil.close(is);
+ }
+ }
+
+ /**
+ * Implementation could override this method if it want to print, log, url requested
+ *
+ * @throws Exception
+ */
+ public void traceUrl(URL url) throws Exception {
+ String msg = "request : " + url;
+ if (_mojo.displayCmd) {
+ _log.info(msg);
+ } else {
+ _log.debug(msg);
+ }
+ }
+
+ /**
+ * Implementation should provide a way to startNewServer (used if call sendRequestCreateOrUpdate and no server is up)
+ *
+ * @throws Exception
+ */
+ public void startNewServer() throws Exception{
+ _log.info("start scala-tools-server...");
+ Set<String> classpath = new HashSet<String>();
+ //_mojo.addToClasspath("net.alchim31", "scalacs", _csVersion, classpath, true);
+ //JavaMainCaller jcmd = new JavaMainCallerByFork(_mojo, "net_alchim31_scalacs.HttpServer", MainHelper.toMultiPath(classpath.toArray(new String[classpath.size()])), null, null, false);
+
+ _mojo.addToClasspath("org.scala-tools.sbt", "sbt-launch", "0.7.2", classpath, true);
+ String[] jvmArgs = new String[(_jvmArgs == null)?1:_jvmArgs.length + 1];
+ File installDir = new File(System.getProperty("user.home"), ".sbt-launch");
+ jvmArgs[0] = "-Dsbt.boot.properties="+ installConf(new File(installDir, _csArtifactId + "-"+ _csVersion +".boot.properties")).getCanonicalPath();
+ if (_jvmArgs != null) {
+ System.arraycopy(_jvmArgs, 0, jvmArgs, 1, _jvmArgs.length);
+ }
+ FileTailer tailer = new FileTailer(new File(installDir, "update.log"));
+ boolean started = false;
+ try {
+ JavaMainCaller jcmd = new JavaMainCallerByFork(_mojo, "xsbt.boot.Boot", MainHelper.toMultiPath(classpath.toArray(new String[classpath.size()])), jvmArgs, null, false);
+ SpawnMonitor mon = jcmd.spawn(_mojo.displayCmd);
+ for(int i = 60; i>0 && !started && mon.isRunning(); i--) {
+ try {
+ if (_mojo.displayCmd) {
+ System.out.print(tailer.whatNew());
+ } else {
+ System.out.print(".");
+ }
+ Thread.sleep(1000);
+ sendRequest("ping", null);
+ started = true;
+ } catch (java.net.ConnectException exc) {
+ started = false; //useless but more readable
+ }
+ }
+ if (_mojo.displayCmd) {
+ System.out.print(tailer.whatNew());
+ }
+ System.out.println("");
+ } finally {
+ tailer.close();
+ }
+ if (!started) {
+ throw new IllegalStateException("can't start and connect to scalacs");
+ }
+ _mojo.getLog().info("scalacs connected");
+ }
+
+ private File installConf(File scalaCsBootConf) throws Exception {
+ if (!scalaCsBootConf.isFile()) {
+ scalaCsBootConf.getParentFile().mkdirs();
+ InputStream is = null;
+ StringWriter sw = new StringWriter();
+ try {
+ is = this.getClass().getResourceAsStream(BOOT_PROP_RSRC);
+ if (is == null) {
+ is = Thread.currentThread().getContextClassLoader().getResourceAsStream(BOOT_PROP_RSRC);
+ }
+ if (is == null) {
+ String abspath = "/" + this.getClass().getPackage().getName().replace('.', '/') + "/" + BOOT_PROP_RSRC;
+ is = Thread.currentThread().getContextClassLoader().getResourceAsStream(abspath);
+ if (is == null) {
+ throw new IllegalStateException("can't find " + abspath + " in the classpath");
+ }
+ }
+ IOUtil.copy(is, sw);
+ } finally {
+ IOUtil.close(is);
+ IOUtil.close(sw);
+ }
+ Properties p = new Properties(System.getProperties());
+ p.setProperty("scalacs.groupId", _csGroupId);
+ p.setProperty("scalacs.artifactId", _csArtifactId);
+ p.setProperty("scalacs.version", _csVersion);
+ p.setProperty("scalacs.directory", scalaCsBootConf.getParentFile().getCanonicalPath());
+ String cfg = StringUtils.interpolate(sw.toString(), p);
+ FileUtils.fileWrite(scalaCsBootConf.getCanonicalPath(), "UTF-8", cfg);
+ }
+ return scalaCsBootConf;
+ }
+
+ private static class FileTailer {
+ private long _filePointer;
+ private RandomAccessFile _raf;
+ private File _file;
+ public FileTailer(File f) throws Exception {
+ _file = f;
+ _filePointer = f.length();
+ _raf = null;
+ }
+
+ public CharSequence whatNew() throws Exception {
+ StringBuilder back = new StringBuilder();
+ if (_raf == null && _file.isFile()) {
+ _raf = new RandomAccessFile(_file, "r" );
+ }
+ if (_raf != null) {
+ // Compare the length of the file to the file pointer
+ long fileLength = _file.length();
+ if( fileLength < _filePointer ) {
+ // Log file must have been rotated or deleted;
+ // reopen the file and reset the file pointer
+ close();
+ _raf = new RandomAccessFile(_file, "r" );
+ _filePointer = 0;
+ }
+
+ if( fileLength > _filePointer ) {
+ // There is data to read
+ _raf.seek( _filePointer );
+// back = _raf.readUTF();
+
+ String line = null;
+ while( (line = _raf.readLine())!= null ) {
+ back.append( line ).append('\n');
+ }
+ _filePointer = _raf.getFilePointer();
+ }
+ }
+ return back;
+ }
+ public void close() {
+ try {
+ if (_raf != null) {
+ _raf.close();
+ _raf = null;
+ }
+ } catch(Exception e) {
+ // ignore
+ }
+ }
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven_dependency/CheckScalaVersionVisitor.java b/src/main/java/org_scala_tools_maven_dependency/CheckScalaVersionVisitor.java
new file mode 100644
index 0000000..8775bbd
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_dependency/CheckScalaVersionVisitor.java
@@ -0,0 +1,68 @@
+package org_scala_tools_maven_dependency;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.shared.dependency.tree.DependencyNode;
+import org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor;
+import org_scala_tools_maven.VersionNumber;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org_scala_tools_maven_dependency.ScalaConstants.*;
+/**
+ * Ensures that all scala versions match the given version.
+ * @author JSuereth
+ *
+ */
+public class CheckScalaVersionVisitor implements DependencyNodeVisitor {
+ private VersionNumber _version;
+ private boolean _failed = false;
+ private Log _log;
+
+ private List<String> scalaDependentArtifactStrings = new ArrayList<String>();
+
+ public boolean endVisit(@SuppressWarnings("unused") DependencyNode node) {
+ return !_failed;
+ }
+
+ public CheckScalaVersionVisitor(String projectVerison, Log log) {
+ this._version = new VersionNumber(projectVerison);
+ this._log = log;
+ }
+
+ public boolean isScalaDistroArtifact(Artifact artifact) {
+ return SCALA_DISTRO_GROUP.equalsIgnoreCase(artifact.getGroupId()) &&
+ SCALA_DISTRO_ARTIFACTS.contains(artifact.getArtifactId());
+ }
+ public boolean visit(DependencyNode node) {
+ //TODO - Do we care about provided scope?
+ Artifact artifact = node.getArtifact();
+ _log.debug("checking ["+artifact+"] for scala version");
+ //TODO - Handle version ranges???? does that make sense given scala's binary incompatability!
+ if(isScalaDistroArtifact(artifact) && artifact.getVersion() != null) {
+ VersionNumber originalVersion = new VersionNumber(artifact.getVersion());
+ if(originalVersion.compareTo(_version) != 0) {
+ _failed = true;
+ }
+ //If this dependency is transitive, we want to track which artifact requires this...
+ if(node.getParent() != null) { //TODO - Go all the way up the parent chain till we hit the bottom....
+ final Artifact parentArtifact = node.getParent().getArtifact();
+ scalaDependentArtifactStrings.add(" " + StringUtil.makeArtifactNameString(parentArtifact) + " requires scala version: " + originalVersion);
+ }
+ } else {
+ //TODO - What now?
+ }
+ return !_failed;
+ }
+
+ public boolean isFailed() {
+ return _failed;
+ }
+ public void logScalaDependents() {
+ _log.warn(" Expected all dependencies to require Scala version: " + _version);
+ for(String dependString : scalaDependentArtifactStrings) {
+ _log.warn(dependString);
+ }
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven_dependency/ScalaConstants.java b/src/main/java/org_scala_tools_maven_dependency/ScalaConstants.java
new file mode 100644
index 0000000..b928126
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_dependency/ScalaConstants.java
@@ -0,0 +1,10 @@
+package org_scala_tools_maven_dependency;
+
+import java.util.Arrays;
+import java.util.List;
+
+public interface ScalaConstants {
+ public static final String SCALA_DISTRO_GROUP="org.scala-lang";
+ public static final List<String> SCALA_DISTRO_ARTIFACTS = Arrays.asList("scala-library", "scala-swing", "scala-dbc", "scala-compiler", "scalap", "partest");
+
+}
\ No newline at end of file
diff --git a/src/main/java/org_scala_tools_maven_dependency/ScalaDistroArtifactFilter.java b/src/main/java/org_scala_tools_maven_dependency/ScalaDistroArtifactFilter.java
new file mode 100644
index 0000000..54ecd18
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_dependency/ScalaDistroArtifactFilter.java
@@ -0,0 +1,24 @@
+package org_scala_tools_maven_dependency;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.shared.dependency.tree.DependencyNode;
+import org.apache.maven.shared.dependency.tree.filter.DependencyNodeFilter;
+
+import static org_scala_tools_maven_dependency.ScalaConstants.*;
+/**
+ * A filter to only look at scala distribution maven artifacts.
+ *
+ * @author JSuereth
+ */
+public class ScalaDistroArtifactFilter implements DependencyNodeFilter, ArtifactFilter {
+ public boolean include(Artifact artifact) {
+ //TODO - Are we checking the right artifacts?
+ return SCALA_DISTRO_GROUP.equalsIgnoreCase(artifact.getGroupId()) &&
+ SCALA_DISTRO_ARTIFACTS.contains(artifact.getArtifactId());
+ }
+ public boolean accept(DependencyNode node) {
+ return include(node.getArtifact());
+ }
+
+}
diff --git a/src/main/java/org_scala_tools_maven_dependency/StringUtil.java b/src/main/java/org_scala_tools_maven_dependency/StringUtil.java
new file mode 100644
index 0000000..d103962
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_dependency/StringUtil.java
@@ -0,0 +1,22 @@
+package org_scala_tools_maven_dependency;
+
+import org.apache.maven.artifact.Artifact;
+
+/**
+ * Utilities for making Error messages.
+ */
+public class StringUtil {
+
+ /**
+ * Creates a human-readable string for an artifact.
+ * @param artifact
+ * @return
+ */
+ public static String makeArtifactNameString(Artifact artifact) {
+ //TODO - Handle version ranges...
+ if(artifact == null) {
+ return "<null artifact>";
+ }
+ return artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion();
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven_executions/JavaMainCaller.java b/src/main/java/org_scala_tools_maven_executions/JavaMainCaller.java
new file mode 100644
index 0000000..df14bbd
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_executions/JavaMainCaller.java
@@ -0,0 +1,44 @@
+package org_scala_tools_maven_executions;
+
+import java.io.File;
+/**
+ * This interface is used to create a call on a main method of a java class.
+ *
+ * The important implementations are JavaCommand and ReflectionJavaCaller
+ *
+ * @author J. Suereth
+ *
+ */
+public interface JavaMainCaller {
+ /** Adds an environemnt variable */
+ public abstract void addEnvVar(String key, String value);
+ /** Adds a JVM arg. Note: This is not available for in-process "forks" */
+ public abstract void addJvmArgs(String... args);
+ /** Adds arguments for the process */
+ public abstract void addArgs(String... args);
+ /** Adds option (basically two arguments) */
+ public abstract void addOption(String key, String value);
+ /** Adds an option (key-file pair). This will pull the absolute path of the file */
+ public abstract void addOption(String key, File value);
+ /** Adds the key if the value is true */
+ public abstract void addOption(String key, boolean value);
+
+ /** request run to be redirected to maven/requester logger */
+ public abstract void redirectToLog();
+
+ // TODO: avoid to have several Thread to pipe stream
+ // TODO: add support to inject startup command and shutdown command (on :quit)
+ public abstract void run(boolean displayCmd) throws Exception;
+ /** Runs the JavaMain with all the built up arguments/options */
+ public abstract boolean run(boolean displayCmd, boolean throwFailure) throws Exception;
+
+ /**
+ * run the command without stream redirection nor waiting for exit
+ *
+ * @param displayCmd
+ * @return the spawn Process (or null if no process was spawned)
+ * @throws Exception
+ */
+ public abstract SpawnMonitor spawn(boolean displayCmd) throws Exception;
+
+}
\ No newline at end of file
diff --git a/src/main/java/org_scala_tools_maven_executions/JavaMainCallerByFork.java b/src/main/java/org_scala_tools_maven_executions/JavaMainCallerByFork.java
new file mode 100644
index 0000000..a0cb7dd
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_executions/JavaMainCallerByFork.java
@@ -0,0 +1,169 @@
+package org_scala_tools_maven_executions;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.exec.CommandLine;
+import org.apache.commons.exec.DefaultExecutor;
+import org.apache.commons.exec.ExecuteException;
+import org.apache.commons.exec.Executor;
+import org.apache.commons.exec.LogOutputStream;
+import org.apache.commons.exec.OS;
+import org.apache.commons.exec.PumpStreamHandler;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoFailureException;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * forked java commands.
+ *
+ * @author D. Bernard
+ * @author J. Suereth
+ */
+public class JavaMainCallerByFork extends JavaMainCallerSupport {
+
+ private boolean _forceUseArgFile = false;
+
+ /**
+ * Location of java executable.
+ */
+ private String _javaExec;
+
+ private boolean _redirectToLog;
+
+ public JavaMainCallerByFork(AbstractMojo requester, String mainClassName, String classpath, String[] jvmArgs, String[] args, boolean forceUseArgFile) throws Exception {
+ super(requester, mainClassName, classpath, jvmArgs, args);
+ for (String key : System.getenv().keySet()) {
+ env.add(key + "=" + System.getenv(key));
+ }
+ _javaExec = System.getProperty("java.home");
+ if (_javaExec == null) {
+ _javaExec = System.getenv("JAVA_HOME");
+ if (_javaExec == null) {
+ throw new IllegalStateException("Couldn't locate java, try setting JAVA_HOME environment variable.");
+ }
+ }
+ _javaExec += File.separator + "bin" + File.separator + "java";
+ _forceUseArgFile = forceUseArgFile;
+ }
+
+ public boolean run(boolean displayCmd, boolean throwFailure) throws Exception {
+ List<String> cmd = buildCommand();
+ displayCmd(displayCmd, cmd);
+ Executor exec = new DefaultExecutor();
+
+ //err and out are redirected to out
+ if (!_redirectToLog) {
+ exec.setStreamHandler(new PumpStreamHandler(System.out));
+ } else {
+ exec.setStreamHandler(new PumpStreamHandler(new LogOutputStream() {
+
+ @Override
+ protected void processLine(String line, @SuppressWarnings("unused") int level) {
+ if (line.toLowerCase().indexOf("error") > -1) {
+ requester.getLog().error(line);
+ } else if (line.toLowerCase().indexOf("warn") > -1) {
+ requester.getLog().warn(line);
+ } else {
+ requester.getLog().info(line);
+ }
+ }
+ }));
+ }
+
+ CommandLine cl = new CommandLine(cmd.get(0));
+ for (int i = 1; i < cmd.size(); i++) {
+ cl.addArgument(cmd.get(i));
+ }
+ try {
+ int exitValue = exec.execute(cl);
+ if (exitValue != 0) {
+ if (throwFailure) {
+ throw new MojoFailureException("command line returned non-zero value:" + exitValue);
+ }
+ return false;
+ }
+ return true;
+ } catch (ExecuteException exc) {
+ if (throwFailure) {
+ throw exc;
+ }
+ return false;
+ }
+ }
+
+ public SpawnMonitor spawn(boolean displayCmd) throws Exception {
+ List<String> cmd = buildCommand();
+ File out = new File(System.getProperty("java.io.tmpdir"), mainClassName +".out");
+ out.delete();
+ cmd.add(">"+ out.getCanonicalPath());
+ File err = new File(System.getProperty("java.io.tmpdir"), mainClassName +".err");
+ err.delete();
+ cmd.add("2>"+ err.getCanonicalPath());
+ List<String> cmd2 = new ArrayList<String>();
+ String cmdStr = StringUtils.join(cmd.iterator(), " ");
+ if (OS.isFamilyDOS()) {
+ cmd2.add("cmd.exe");
+ cmd2.add("/C");
+ cmd2.add(cmdStr);
+ } else {
+ cmd2.add("/bin/sh");
+ cmd2.add("-c");
+ cmd2.add(cmdStr);
+ }
+ displayCmd(displayCmd, cmd2);
+ ProcessBuilder pb = new ProcessBuilder(cmd2);
+ //pb.redirectErrorStream(true);
+ final Process p = pb.start();
+ return new SpawnMonitor(){
+ public boolean isRunning() throws Exception {
+ try {
+ p.exitValue();
+ return false;
+ } catch(IllegalThreadStateException e) {
+ return true;
+ }
+ }
+ };
+ }
+
+ private void displayCmd(boolean displayCmd, List<String> cmd) {
+ if (displayCmd) {
+ requester.getLog().info("cmd: " + " " + StringUtils.join(cmd.iterator(), " "));
+ } else if (requester.getLog().isDebugEnabled()) {
+ requester.getLog().debug("cmd: " + " " + StringUtils.join(cmd.iterator(), " "));
+ }
+ }
+
+ protected List<String> buildCommand() throws Exception {
+ ArrayList<String> back = new ArrayList<String>(2 + jvmArgs.size() + args.size());
+ back.add(_javaExec);
+ if (!_forceUseArgFile && (lengthOf(args, 1) + lengthOf(jvmArgs, 1) < 400)) {
+ back.addAll(jvmArgs);
+ back.add(mainClassName);
+ back.addAll(args);
+ } else {
+ File jarPath = new File(MainHelper.locateJar(MainHelper.class));
+ requester.getLog().debug("plugin jar to add :" + jarPath);
+ addToClasspath(jarPath);
+ back.addAll(jvmArgs);
+ back.add(MainWithArgsInFile.class.getName());
+ back.add(mainClassName);
+ back.add(MainHelper.createArgFile(args).getCanonicalPath());
+ }
+ return back;
+ }
+
+ private long lengthOf(List<String> l, long sepLength) throws Exception {
+ long back = 0;
+ for (String str : l) {
+ back += str.length() + sepLength;
+ }
+ return back;
+ }
+
+ public void redirectToLog() {
+ _redirectToLog = true;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org_scala_tools_maven_executions/JavaMainCallerInProcess.java b/src/main/java/org_scala_tools_maven_executions/JavaMainCallerInProcess.java
new file mode 100644
index 0000000..8a6d721
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_executions/JavaMainCallerInProcess.java
@@ -0,0 +1,101 @@
+package org_scala_tools_maven_executions;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.codehaus.plexus.util.StringUtils;
+/**
+ * This class will call a java main method via reflection.
+ *
+ * @author J. Suereth
+ *
+ * Note: a -classpath argument *must* be passed into the jvmargs.
+ *
+ */
+public class JavaMainCallerInProcess extends JavaMainCallerSupport {
+
+ private ClassLoader _cl = null;
+
+ public JavaMainCallerInProcess(AbstractMojo requester, String mainClassName, String classpath, String[] jvmArgs, String[] args) throws Exception {
+ super(requester, mainClassName, "", jvmArgs, args);
+
+ //Pull out classpath and create class loader
+ ArrayList<URL> urls = new ArrayList<URL>();
+ for(String path : classpath.split(File.pathSeparator)) {
+ try {
+ urls.add(new File(path).toURI().toURL());
+ } catch (MalformedURLException e) {
+ //TODO - Do something usefull here...
+ requester.getLog().error(e);
+ }
+ }
+ _cl = new URLClassLoader(urls.toArray(new URL[urls.size()]), (ClassLoader)null);
+ }
+
+
+
+ @Override
+ public void addJvmArgs(String... args) {
+ //TODO - Ignore classpath
+ if (args != null) {
+ for (String arg : args) {
+ requester.getLog().warn("jvmArgs are ignored when run in process :" + arg);
+ }
+ }
+ }
+
+ public boolean run(boolean displayCmd, boolean throwFailure) throws Exception {
+ try {
+ runInternal(displayCmd);
+ return true;
+ } catch (Exception e) {
+ if(throwFailure) {
+ throw e;
+ }
+ return false;
+ }
+ }
+
+ /**
+ * spawns a thread to run the method
+ */
+ public SpawnMonitor spawn(final boolean displayCmd) throws Exception {
+ final Thread t = new Thread() {
+ @Override
+ public void run() {
+ try {
+ runInternal(displayCmd);
+ } catch (Exception e) {
+ // Ignore
+ }
+ }
+ };
+ t.start();
+ return new SpawnMonitor() {
+ public boolean isRunning() throws Exception {
+ return t.isAlive();
+ }
+ };
+ }
+
+ /** Runs the main method of a java class */
+ private void runInternal(boolean displayCmd) throws Exception {
+ String[] argArray = args.toArray(new String[args.size()]);
+ if(displayCmd) {
+ requester.getLog().info("cmd : " + mainClassName + "(" + StringUtils.join(argArray, ",")+")");
+ }
+ MainHelper.runMain(mainClassName, args, _cl);
+ }
+
+
+
+ public void redirectToLog() {
+ requester.getLog().warn("redirection to log is not supported for 'inProcess' mode");
+ }
+
+
+}
diff --git a/src/main/java/org_scala_tools_maven_executions/JavaMainCallerSupport.java b/src/main/java/org_scala_tools_maven_executions/JavaMainCallerSupport.java
new file mode 100644
index 0000000..fe97d95
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_executions/JavaMainCallerSupport.java
@@ -0,0 +1,98 @@
+package org_scala_tools_maven_executions;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.codehaus.plexus.util.StringUtils;
+/**
+ * Abstract helper implementation for JavaMainCaller interface.
+ * @author josh
+ *
+ */
+public abstract class JavaMainCallerSupport implements JavaMainCaller {
+
+ protected AbstractMojo requester;
+ protected List<String> env = new ArrayList<String>();
+ protected String mainClassName;
+ protected List<String> jvmArgs = new ArrayList<String>();
+ protected List<String> args = new ArrayList<String>();
+
+
+ protected JavaMainCallerSupport(AbstractMojo requester, String mainClassName, String classpath, String[] jvmArgs, String[] args) throws Exception {
+ this.requester = requester;
+ for (String key : System.getenv().keySet()) {
+ env.add(key + "=" + System.getenv(key));
+ }
+ this.mainClassName = mainClassName;
+ addJvmArgs("-classpath", classpath);
+ addJvmArgs(jvmArgs);
+ addArgs(args);
+ }
+
+ public void addJvmArgs(String... args) {
+ if(args != null) {
+ for(String arg : args) {
+ if (StringUtils.isNotEmpty(arg)) {
+ this.jvmArgs.add(arg);
+ }
+ }
+ }
+ }
+
+ public void addToClasspath(File entry) throws Exception {
+ if ((entry == null) || !entry.exists()) {
+ return;
+ }
+ boolean isClasspath = false;
+ for (int i = 0; i < jvmArgs.size(); i++) {
+ String item = jvmArgs.get(i);
+ if (isClasspath) {
+ item = item + File.pathSeparator + entry.getCanonicalPath();
+ jvmArgs.set(i, item);
+ isClasspath = false;
+ break;
+ }
+ isClasspath = "-classpath".equals(item);
+ }
+ }
+
+ public void addOption(String key, String value) {
+ if (StringUtils.isEmpty(value) || StringUtils.isEmpty(key)) {
+ return;
+ }
+ addArgs(key, value);
+ }
+
+ public void addOption(String key, File value) {
+ if ( (value == null) || StringUtils.isEmpty(key)) {
+ return;
+ }
+ addArgs(key, value.getAbsolutePath());
+ }
+
+ public void addOption(String key, boolean value) {
+ if ((!value) || StringUtils.isEmpty(key)) {
+ return;
+ }
+ addArgs(key);
+ }
+ public void addArgs(String... args) {
+ if(args != null) {
+ for(String arg : args) {
+ if (StringUtils.isNotEmpty(arg)) {
+ this.args.add(arg);
+ }
+ }
+ }
+ }
+
+ public void addEnvVar(String key, String value) {
+ this.env.add(key + "=" + value);
+
+ }
+ public void run(boolean displayCmd) throws Exception {
+ run(displayCmd, true);
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven_executions/MainHelper.java b/src/main/java/org_scala_tools_maven_executions/MainHelper.java
new file mode 100644
index 0000000..41c6ec4
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_executions/MainHelper.java
@@ -0,0 +1,183 @@
+package org_scala_tools_maven_executions;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.codehaus.plexus.util.DirectoryScanner;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * Helper methods
+ * @author David Bernard
+ */
+public class MainHelper {
+
+ public static String toMultiPath(List<String> paths) {
+ return StringUtils.join(paths.iterator(), File.pathSeparator);
+ }
+
+ public static String toMultiPath(String[] paths) {
+ return StringUtils.join(paths, File.pathSeparator);
+ }
+
+ public static String[] findFiles(File dir, String pattern) {
+ return findFiles(dir, new String[] { pattern }, new String[0]);
+ }
+
+ public static String[] findFiles(File dir, String[] includes, String[] excludes) {
+ DirectoryScanner scanner = new DirectoryScanner();
+ scanner.setBasedir(dir);
+ scanner.setIncludes(includes);
+ scanner.setExcludes(excludes);
+ scanner.addDefaultExcludes();
+ scanner.scan();
+ return scanner.getIncludedFiles();
+ }
+
+ public static String toClasspathString(ClassLoader cl) throws Exception {
+ StringBuilder back = new StringBuilder();
+ List<String> cps = new LinkedList<String>();
+ appendUrltoClasspathCollection(cl, cps);
+ for(String cp : cps) {
+ if (back.length() != 0) {
+ back.append(File.pathSeparatorChar);
+ }
+ back.append(cp);
+ }
+ return back.toString();
+ }
+
+ public static void appendUrltoClasspathCollection(ClassLoader cl, Collection<String> classpath) throws Exception {
+ if (cl == null) {
+ cl = Thread.currentThread().getContextClassLoader();
+ }
+ while (cl != null) {
+ if (cl instanceof URLClassLoader) {
+ URLClassLoader ucl = (URLClassLoader) cl;
+ URL[] urls = ucl.getURLs();
+ for (URL url : urls) {
+ classpath.add(url.getFile());
+ }
+ }
+ cl = cl.getParent();
+ }
+ }
+
+ /**
+ * Escapes arguments as necessary so the StringTokenizer for scala arguments pulls in filenames with spaces correctly.
+ * @param arg
+ * @return
+ */
+ private static String escapeArgumentForScalacArgumentFile(String arg) {
+ if(arg.matches(".*\\s.*")) {
+ return '"' + arg + '"';
+ }
+ return arg;
+ }
+
+ /**
+ * UnEscapes arguments as necessary so the StringTokenizer for scala arguments pulls in filenames with spaces correctly.
+ * @param arg
+ * @return
+ */
+ private static String unescapeArgumentForScalacArgumentFile(String arg) {
+ if(arg.charAt(0) == '"' && arg.charAt(arg.length() -1) == '"') {
+ return arg.substring(1, arg.length() -1);
+ }
+ return arg;
+ }
+
+ /**
+ * Creates a file containing all the arguments. This file has a very simple format of argument (white-space argument).
+ *
+ * @return
+ * @throws IOException
+ */
+ public static File createArgFile(List<String> args) throws IOException {
+ final File argFile = File.createTempFile("scala-maven-", ".args");
+ //argFile.deleteOnExit();
+ final PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(argFile)));
+ try {
+ for(String arg : args) {
+ out.println(escapeArgumentForScalacArgumentFile(arg));
+ }
+ } finally {
+ out.close();
+ }
+ return argFile;
+ }
+
+ /**
+ * Creates a file containing all the arguments. This file has a very simple format of argument (white-space argument).
+ *
+ * @return
+ * @throws IOException
+ */
+ public static List<String> readArgFile(File argFile) throws IOException {
+ ArrayList<String> back = new ArrayList<String>();
+ final BufferedReader in = new BufferedReader(new FileReader(argFile));
+ try {
+ String line = null;
+ while ((line = in.readLine()) != null) {
+ back.add(unescapeArgumentForScalacArgumentFile(line));
+ }
+ } finally {
+ in.close();
+ }
+ return back;
+ }
+
+ /** Runs the main method of a java class */
+ public static void runMain(String mainClassName, List<String> args, ClassLoader cl) throws Exception {
+ if(cl == null) {
+ cl = Thread.currentThread().getContextClassLoader();
+ }
+ Class<?> mainClass = cl.loadClass(mainClassName);
+ Method mainMethod = mainClass.getMethod("main", String[].class);
+ int mods = mainMethod.getModifiers();
+ if(mainMethod.getReturnType() != void.class || !Modifier.isStatic(mods) || !Modifier.isPublic(mods)) {
+ throw new NoSuchMethodException("main");
+ }
+ String[] argArray = args.toArray(new String[args.size()]);
+
+ //TODO - Redirect System.in System.err and System.out
+
+ mainMethod.invoke(null, new Object[] {argArray});
+ }
+
+ public static String locateJar(Class<?> c) throws Exception {
+ final URL location;
+ final String classLocation = c.getName().replace('.', '/') + ".class";
+ final ClassLoader loader = c.getClassLoader();
+ if( loader == null ) {
+ location = ClassLoader.getSystemResource(classLocation);
+ } else {
+ location = loader.getResource(classLocation);
+ }
+ if( location != null ){
+ Pattern p = Pattern.compile( "^.*file:(.*)!.*$" ) ;
+ Matcher m = p.matcher( location.toString() ) ;
+ if( m.find() ) {
+ return URLDecoder.decode(m.group( 1 ), "UTF-8") ;
+ }
+ throw new ClassNotFoundException( "Cannot parse location of '" + location + "'. Probably not loaded from a Jar" ) ;
+ }
+ throw new ClassNotFoundException( "Cannot find class '" + c.getName() + " using the classloader" ) ;
+ }
+}
diff --git a/src/main/java/org_scala_tools_maven_executions/MainWithArgsInFile.java b/src/main/java/org_scala_tools_maven_executions/MainWithArgsInFile.java
new file mode 100644
index 0000000..0e59d3b
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_executions/MainWithArgsInFile.java
@@ -0,0 +1,33 @@
+package org_scala_tools_maven_executions;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Use a file and reflection to start a main class with arguments define in a file.
+ * This class should run without other dependencies than jre.
+ * This class is used as a workaround to the windows command line size limitation.
+ *
+ * @author David Bernard
+ */
+public class MainWithArgsInFile {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ try {
+ String mainClassName = args[0];
+ List<String> argsFromFile = new ArrayList<String>();
+ if (args.length > 0) {
+ argsFromFile = MainHelper.readArgFile(new File(args[1]));
+ }
+ MainHelper.runMain(mainClassName, argsFromFile, null);
+ } catch(Throwable t) {
+ t.printStackTrace();
+ System.exit(-10000 /*Integer.MIN_VALUE*/);
+ }
+ }
+
+}
diff --git a/src/main/java/org_scala_tools_maven_executions/SpawnMonitor.java b/src/main/java/org_scala_tools_maven_executions/SpawnMonitor.java
new file mode 100644
index 0000000..a9ad28e
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_executions/SpawnMonitor.java
@@ -0,0 +1,5 @@
+package org_scala_tools_maven_executions;
+
+public interface SpawnMonitor {
+ public boolean isRunning() throws Exception;
+}
diff --git a/src/main/java/org_scala_tools_maven_model/MavenProjectAdapter.java b/src/main/java/org_scala_tools_maven_model/MavenProjectAdapter.java
new file mode 100644
index 0000000..728a64f
--- /dev/null
+++ b/src/main/java/org_scala_tools_maven_model/MavenProjectAdapter.java
@@ -0,0 +1,864 @@
+package org_scala_tools_maven_model;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.model.Build;
+import org.apache.maven.model.CiManagement;
+import org.apache.maven.model.Contributor;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.model.Developer;
+import org.apache.maven.model.DistributionManagement;
+import org.apache.maven.model.IssueManagement;
+import org.apache.maven.model.License;
+import org.apache.maven.model.MailingList;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Organization;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginManagement;
+import org.apache.maven.model.Prerequisites;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.Reporting;
+import org.apache.maven.model.Repository;
+import org.apache.maven.model.Resource;
+import org.apache.maven.model.Scm;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.artifact.InvalidDependencyVersionException;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+ at SuppressWarnings("unchecked")
+public class MavenProjectAdapter {
+
+ final MavenProject wrapped;
+
+ public MavenProjectAdapter(MavenProject project) {
+ this.wrapped = project;
+ }
+
+ public List<Profile> getActiveProfiles() {
+ return wrapped.getActiveProfiles();
+ }
+
+ public Map<String, Artifact> getArtifactMap() {
+ return wrapped.getArtifactMap();
+ }
+
+ public Set<Artifact> getArtifacts() {
+ return wrapped.getArtifacts();
+ }
+
+ public List<Artifact> getAttachedArtifacts() {
+ return wrapped.getAttachedArtifacts();
+ }
+
+ public List<Plugin> getBuildPlugins() {
+ return wrapped.getBuildPlugins();
+ }
+
+ public List<MavenProject> getCollectedProjects() {
+ // TODO Auto-generated method stub
+ return wrapped.getCollectedProjects();
+ }
+
+ public List<Artifact> getCompileArtifacts() {
+ return wrapped.getCompileArtifacts();
+ }
+
+ public List<String> getCompileClasspathElements()
+ throws DependencyResolutionRequiredException {
+ return wrapped.getCompileClasspathElements();
+ }
+
+ public List<Dependency> getCompileDependencies() {
+ return wrapped.getCompileDependencies();
+ }
+
+ public List<String> getCompileSourceRoots() {
+ return wrapped.getCompileSourceRoots();
+ }
+
+ public List<Contributor> getContributors() {
+ return wrapped.getContributors();
+ }
+
+
+ public List<Dependency> getDependencies() {
+ return wrapped.getDependencies();
+ }
+
+
+ public Set<Artifact> getDependencyArtifacts() {
+ return wrapped.getDependencyArtifacts();
+ }
+
+
+ public List<Developer> getDevelopers() {
+ return wrapped.getDevelopers();
+ }
+
+
+ public Map<String, Artifact> getExtensionArtifactMap() {
+ return wrapped.getExtensionArtifactMap();
+ }
+
+
+ public Set<Artifact> getExtensionArtifacts() {
+ return wrapped.getExtensionArtifacts();
+ }
+
+
+ public List<String> getFilters() {
+ return wrapped.getFilters();
+ }
+
+
+ public List<License> getLicenses() {
+ return wrapped.getLicenses();
+ }
+
+
+ public List<MailingList> getMailingLists() {
+ return wrapped.getMailingLists();
+ }
+
+
+ public Map getManagedVersionMap() {
+ // TODO Figure out what is here
+ return wrapped.getManagedVersionMap();
+ }
+
+
+ public List<String> getModules() {
+ return wrapped.getModules();
+ }
+
+
+ public Map<String, Artifact> getPluginArtifactMap() {
+ return wrapped.getPluginArtifactMap();
+ }
+
+
+ public List<ArtifactRepository> getPluginArtifactRepositories() {
+ return wrapped.getPluginArtifactRepositories();
+ }
+
+
+ public Set<Artifact> getPluginArtifacts() {
+ return wrapped.getPluginArtifacts();
+ }
+
+
+ public List<Repository> getPluginRepositories() {
+ return wrapped.getPluginRepositories();
+ }
+
+
+ public Map<String, MavenProject> getProjectReferences() {
+ return wrapped.getProjectReferences();
+ }
+
+
+ public List<ArtifactRepository> getRemoteArtifactRepositories() {
+ return wrapped.getRemoteArtifactRepositories();
+ }
+
+
+ public Map<String, Artifact> getReportArtifactMap() {
+ return wrapped.getReportArtifactMap();
+ }
+
+
+ public Set<Artifact> getReportArtifacts() {
+ return wrapped.getReportArtifacts();
+ }
+
+
+ public List<Plugin> getReportPlugins() {
+ return wrapped.getReportPlugins();
+ }
+
+
+ public List<Repository> getRepositories() {
+ return wrapped.getRepositories();
+ }
+
+
+ public List<Resource> getResources() {
+ return wrapped.getResources();
+ }
+
+
+ public List<Artifact> getRuntimeArtifacts() {
+ return wrapped.getRuntimeArtifacts();
+ }
+
+
+ public List<String> getRuntimeClasspathElements()
+ throws DependencyResolutionRequiredException {
+ return wrapped.getRuntimeClasspathElements();
+ }
+
+
+ public List<Dependency> getRuntimeDependencies() {
+ return wrapped.getRuntimeDependencies();
+ }
+
+
+ public List<String> getScriptSourceRoots() {
+ return wrapped.getScriptSourceRoots();
+ }
+
+
+ public List<Artifact> getSystemArtifacts() {
+ return wrapped.getSystemArtifacts();
+ }
+
+
+ public List<String> getSystemClasspathElements()
+ throws DependencyResolutionRequiredException {
+ return wrapped.getSystemClasspathElements();
+ }
+
+
+ public List<Dependency> getSystemDependencies() {
+ return wrapped.getSystemDependencies();
+ }
+
+
+ public List<Artifact> getTestArtifacts() {
+ return wrapped.getTestArtifacts();
+ }
+
+
+ public List<String> getTestClasspathElements()
+ throws DependencyResolutionRequiredException {
+ return wrapped.getTestClasspathElements();
+ }
+
+
+ public List<String> getTestCompileSourceRoots() {
+ return wrapped.getTestCompileSourceRoots();
+ }
+
+
+ public List<Dependency> getTestDependencies() {
+ return wrapped.getTestDependencies();
+ }
+
+
+ public List<Resource> getTestResources() {
+ return wrapped.getTestResources();
+ }
+
+ /**
+ * Returns the property identified by the string. Multiple objects are
+ * checked to resolve the property:
+ * <ol>
+ * <li>The system properties (System.getProperty(key))</li>
+ * <li>The environment properties (System.getenv(key))</li>
+ * <li>The project properties (project.getProperty(key))</li>
+ * <li>
+ * The "standard" properties that one can reference in the pom. IE
+ * artifactId, build.directory, etc... Note: If the variable starts with
+ * project it may be dropped It is recommended that instead of using this
+ * method that you use get... (getArtifactId(),
+ * getBuild().getBuildDirectory)</li>
+ * </ol>
+ * first checked, then Environment variables, then the Project properties
+ *
+ * @param key
+ * @return
+ */
+ public String apply(String key) {
+ if (key == null) {
+ return null;
+ }
+ if (System.getProperty(key) != null) {
+ return System.getProperty(key);
+ }
+ if (System.getenv(key) != null) {
+ return System.getenv(key);
+ }
+ if (key.equals("build.directory")
+ || key.equals("project.build.directory")
+ || key.equals("buildDirectory")
+ || key.equals("project.buildDirectory")) {
+ return getBuild().getDirectory();
+ }
+ if (key.equals("outputDirectory")
+ || key.equals("project.outputDirectory")
+ || key.equals("output.directory")
+ || key.equals("project.output.directory"))
+ return getBuild().getOutputDirectory();
+
+ if (key.equals("artifactId") || key.equals("project.artifactId")) {
+ return getArtifactId();
+ }
+
+ if (key.equals("basedir") || key.equals("project.basedir"))
+ return getBasedir().getAbsolutePath();
+
+ if (key.equals("defaultGoal") || key.equals("project.defaultGoal"))
+ return getBuild().getDefaultGoal();
+
+ if (key.equals("finalName") || key.equals("project.finalName"))
+ return getBuild().getFinalName();
+ if (key.equals("scriptSourceDirectory")
+ || key.equals("project.scriptSourceDirectory")
+ || key.equals("script.source.directory")
+ || key.equals("project.script.source.directory"))
+ return getBuild().getScriptSourceDirectory();
+ if (key.equals("source.directory")
+ || key.equals("project.source.directory")
+ || key.equals("sourceDirectory")
+ || key.equals("project.sourceDirectory"))
+ return getBuild().getSourceDirectory();
+ if (key.equals("test.output.directory")
+ || key.equals("project.test.output.directory")
+ || key.equals("testOutputDirectory")
+ || key.equals("project.testOutputDirectory"))
+ return getBuild().getTestOutputDirectory();
+ if (key.equals("test.source.directory")
+ || key.equals("project.test.source.directory")
+ || key.equals("testSourceDirectory")
+ || key.equals("project.testSourceDirectory"))
+ return getBuild().getTestSourceDirectory();
+ if (key.equals("directory") || key.equals("project.directory"))
+ return getDescription();
+ if (key.equals("pom"))
+ return getFile().getAbsolutePath();
+ if (key.equals("groupId") || key.equals("project.groupId"))
+ return getGroupId();
+ if (key.equals("id") || key.equals("project.id"))
+ return getId();
+ if (key.equals("inception") || key.equals("project.inception")
+ || key.equals("inceptionYear")
+ || key.equals("project.inceptionYear")
+ || key.equals("inception.year")
+ || key.equals("project.inception.year"))
+ return getInceptionYear();
+ if (key.equals("name") || key.equals("project.name"))
+ return getName();
+ if (key.equals("packaging") || key.equals("project.packaging"))
+ return getModel().getPackaging();
+ if (key.equals("url") || key.equals("project.url"))
+ return getModel().getUrl();
+ if (key.equals("version") || key.equals("project.version"))
+ return getModel().getVersion();
+
+ return wrapped.getProperties().getProperty(key);
+ }
+
+ public String apply(String key, String defaultValue) {
+ String result = apply(key);
+ if (result == null) {
+ return defaultValue;
+ }
+ return result;
+ }
+
+ public void update(String key, String value) {
+ if (key.equals("build.directory")
+ || key.equals("project.build.directory")
+ || key.equals("buildDirectory")
+ || key.equals("project.buildDirectory")) {
+ getBuild().setDirectory(value);
+ } else if (key.equals("outputDirectory")
+ || key.equals("project.outputDirectory")
+ || key.equals("output.directory")
+ || key.equals("project.output.directory")) {
+ getBuild().setOutputDirectory(value);
+ } else if (key.equals("artifactId") || key.equals("project.artifactId")) {
+ setArtifactId(value);
+ } else if (key.equals("defaultGoal")
+ || key.equals("project.defaultGoal")) {
+ getBuild().setDefaultGoal(value);
+ } else if (key.equals("finalName") || key.equals("project.finalName")) {
+ getBuild().setFinalName(value);
+ } else if (key.equals("scriptSourceDirectory")
+ || key.equals("project.scriptSourceDirectory")
+ || key.equals("script.source.directory")
+ || key.equals("project.script.source.directory")) {
+ getBuild().setScriptSourceDirectory(value);
+ } else if (key.equals("source.directory")
+ || key.equals("project.source.directory")
+ || key.equals("sourceDirectory")
+ || key.equals("project.sourceDirectory")) {
+ getBuild().setSourceDirectory(value);
+ } else if (key.equals("test.output.directory")
+ || key.equals("project.test.output.directory")
+ || key.equals("testOutputDirectory")
+ || key.equals("project.testOutputDirectory")) {
+ getBuild().setTestOutputDirectory(value);
+ } else if (key.equals("test.source.directory")
+ || key.equals("project.test.source.directory")
+ || key.equals("testSourceDirectory")
+ || key.equals("project.testSourceDirectory")) {
+ getBuild().setTestSourceDirectory(value);
+ } else if (key.equals("directory") || key.equals("project.directory")) {
+ setDescription(value);
+ } else if (key.equals("pom")) {
+ setFile(new File(value));
+ } else if (key.equals("groupId") || key.equals("project.groupId")) {
+ setGroupId(value);
+ } else if (key.equals("inception") || key.equals("project.inception")
+ || key.equals("inceptionYear")
+ || key.equals("project.inceptionYear")
+ || key.equals("inception.year")
+ || key.equals("project.inception.year")) {
+ setInceptionYear(value);
+ } else if (key.equals("name") || key.equals("project.name")) {
+ setName(value);
+ } else if (key.equals("packaging") || key.equals("project.packaging")) {
+ getModel().setPackaging(value);
+ } else if (key.equals("url") || key.equals("project.url")) {
+ getModel().setUrl(value);
+ } else if (key.equals("version") || key.equals("project.version")) {
+ getModel().setVersion(value);
+ } else {
+ wrapped.getProperties().setProperty(key, value);
+ }
+ }
+
+ public void update(String key, int value) {
+ update(key, String.valueOf(value));
+ }
+
+ public void update(String key, boolean value) {
+ update(key, String.valueOf(value));
+ }
+
+ public void update(String key, double value) {
+ update(key, String.valueOf(value));
+ }
+
+ public void update(String key, long value) {
+ update(key, String.valueOf(value));
+ }
+
+ public void update(String key, char value) {
+ update(key, String.valueOf(value));
+ }
+
+ public void update(String key, float value) {
+ update(key, String.valueOf(value));
+ }
+
+ public void update(String key, byte value) {
+ update(key, String.valueOf(value));
+ }
+
+ public void addAttachedArtifact(Artifact artifact) {
+ wrapped.addAttachedArtifact(artifact);
+ }
+
+ public void addCompileSourceRoot(String path) {
+ wrapped.addCompileSourceRoot(path);
+ }
+
+ public void addContributor(Contributor contributor) {
+ wrapped.addContributor(contributor);
+ }
+
+ public void addDeveloper(Developer developer) {
+ wrapped.addDeveloper(developer);
+ }
+
+ public void addLicense(License license) {
+ wrapped.addLicense(license);
+ }
+
+ public void addMailingList(MailingList mailingList) {
+ wrapped.addMailingList(mailingList);
+ }
+
+ public void addPlugin(Plugin plugin) {
+ wrapped.addPlugin(plugin);
+ }
+
+ public void addProjectReference(MavenProject project) {
+ wrapped.addProjectReference(project);
+ }
+
+ public void addResource(Resource resource) {
+ wrapped.addResource(resource);
+ }
+
+ public void addScriptSourceRoot(String path) {
+ wrapped.addScriptSourceRoot(path);
+ }
+
+ public void addTestCompileSourceRoot(String path) {
+ wrapped.addTestCompileSourceRoot(path);
+ }
+
+ public void addTestResource(Resource testResource) {
+ wrapped.addTestResource(testResource);
+ }
+
+ public Set<Artifact> createArtifacts(ArtifactFactory artifactFactory,
+ String inheritedScope, ArtifactFilter dependencyFilter)
+ throws InvalidDependencyVersionException {
+ return wrapped.createArtifacts(artifactFactory, inheritedScope,
+ dependencyFilter);
+ }
+
+ @Override
+ public boolean equals(Object arg0) {
+ return wrapped.equals(arg0);
+ }
+
+ public Artifact getArtifact() {
+ return wrapped.getArtifact();
+ }
+
+ public String getArtifactId() {
+ return wrapped.getArtifactId();
+ }
+
+ public File getBasedir() {
+ return wrapped.getBasedir();
+ }
+
+ public Build getBuild() {
+ return wrapped.getBuild();
+ }
+
+ public List getBuildExtensions() {
+ return wrapped.getBuildExtensions();
+ }
+
+ public CiManagement getCiManagement() {
+ return wrapped.getCiManagement();
+ }
+
+ public String getDefaultGoal() {
+ return wrapped.getDefaultGoal();
+ }
+
+ public DependencyManagement getDependencyManagement() {
+ return wrapped.getDependencyManagement();
+ }
+
+ public String getDescription() {
+ return wrapped.getDescription();
+ }
+
+ public DistributionManagement getDistributionManagement() {
+ return wrapped.getDistributionManagement();
+ }
+
+ public ArtifactRepository getDistributionManagementArtifactRepository() {
+ return wrapped.getDistributionManagementArtifactRepository();
+ }
+
+ public MavenProject getExecutionProject() {
+ return wrapped.getExecutionProject();
+ }
+
+ public File getFile() {
+ return wrapped.getFile();
+ }
+
+ public Xpp3Dom getGoalConfiguration(String arg0, String arg1, String arg2,
+ String arg3) {
+ return wrapped.getGoalConfiguration(arg0, arg1, arg2, arg3);
+ }
+
+ public String getGroupId() {
+ return wrapped.getGroupId();
+ }
+
+ public String getId() {
+ return wrapped.getId();
+ }
+
+ public String getInceptionYear() {
+ return wrapped.getInceptionYear();
+ }
+
+ public IssueManagement getIssueManagement() {
+ return wrapped.getIssueManagement();
+ }
+
+ public Model getModel() {
+ return wrapped.getModel();
+ }
+
+ public String getModelVersion() {
+ return wrapped.getModelVersion();
+ }
+
+ public String getModulePathAdjustment(MavenProject arg0) throws IOException {
+ return wrapped.getModulePathAdjustment(arg0);
+ }
+
+ public String getName() {
+ return wrapped.getName();
+ }
+
+ public Organization getOrganization() {
+ return wrapped.getOrganization();
+ }
+
+ public Model getOriginalModel() {
+ return wrapped.getOriginalModel();
+ }
+
+ public String getPackaging() {
+ return wrapped.getPackaging();
+ }
+
+ public MavenProject getParent() {
+ return wrapped.getParent();
+ }
+
+ public Artifact getParentArtifact() {
+ return wrapped.getParentArtifact();
+ }
+
+ public PluginManagement getPluginManagement() {
+ return wrapped.getPluginManagement();
+ }
+
+ public Prerequisites getPrerequisites() {
+ return wrapped.getPrerequisites();
+ }
+
+ public Properties getProperties() {
+ return wrapped.getProperties();
+ }
+
+ public Xpp3Dom getReportConfiguration(String arg0, String arg1, String arg2) {
+ return wrapped.getReportConfiguration(arg0, arg1, arg2);
+ }
+
+ public Reporting getReporting() {
+ return wrapped.getReporting();
+ }
+
+ public Scm getScm() {
+ return wrapped.getScm();
+ }
+
+ public String getUrl() {
+ return wrapped.getUrl();
+ }
+
+ public String getVersion() {
+ return wrapped.getVersion();
+ }
+
+ @Override
+ public int hashCode() {
+ return wrapped.hashCode();
+ }
+
+ public boolean hasParent() {
+ return wrapped.hasParent();
+ }
+
+ public void injectPluginManagementInfo(Plugin arg0) {
+ wrapped.injectPluginManagementInfo(arg0);
+ }
+
+ public boolean isExecutionRoot() {
+ return wrapped.isExecutionRoot();
+ }
+
+ public Artifact replaceWithActiveArtifact(Artifact arg0) {
+ return wrapped.replaceWithActiveArtifact(arg0);
+ }
+
+ public void setActiveProfiles(List<Profile> activeProfiles) {
+ wrapped.setActiveProfiles(activeProfiles);
+ }
+
+ public void setArtifact(Artifact artifact) {
+ wrapped.setArtifact(artifact);
+ }
+
+ public void setArtifactId(String artifactId) {
+ wrapped.setArtifactId(artifactId);
+ }
+
+ public void setArtifacts(Set<Artifact> artifacts) {
+ wrapped.setArtifacts(artifacts);
+ }
+
+ public void setBuild(Build build) {
+ wrapped.setBuild(build);
+ }
+
+ public void setCiManagement(CiManagement ciManagement) {
+ wrapped.setCiManagement(ciManagement);
+ }
+
+ public void setCollectedProjects(List<MavenProject> collectedProjects) {
+ wrapped.setCollectedProjects(collectedProjects);
+ }
+
+ public void setContributors(List<Contributor> contributors) {
+ wrapped.setContributors(contributors);
+ }
+
+ public void setDependencies(List dependencies) {
+ wrapped.setDependencies(dependencies);
+ }
+
+ public void setDependencyArtifacts(Set dependencyArtifacts) {
+ wrapped.setDependencyArtifacts(dependencyArtifacts);
+ }
+
+ public void setDescription(String description) {
+ wrapped.setDescription(description);
+ }
+
+ public void setDevelopers(List developers) {
+ wrapped.setDevelopers(developers);
+ }
+
+ public void setDistributionManagement(
+ DistributionManagement distributionManagement) {
+ wrapped.setDistributionManagement(distributionManagement);
+ }
+
+ public void setExecutionProject(MavenProject executionProject) {
+ wrapped.setExecutionProject(executionProject);
+ }
+
+ public void setExecutionRoot(boolean executionRoot) {
+ wrapped.setExecutionRoot(executionRoot);
+ }
+
+ public void setExtensionArtifacts(Set extensionArtifacts) {
+ wrapped.setExtensionArtifacts(extensionArtifacts);
+ }
+
+ public void setFile(File file) {
+ wrapped.setFile(file);
+ }
+
+ public void setGroupId(String groupId) {
+ wrapped.setGroupId(groupId);
+ }
+
+ public void setInceptionYear(String inceptionYear) {
+ wrapped.setInceptionYear(inceptionYear);
+ }
+
+ public void setIssueManagement(IssueManagement issueManagement) {
+ wrapped.setIssueManagement(issueManagement);
+ }
+
+ public void setLicenses(List licenses) {
+ wrapped.setLicenses(licenses);
+ }
+
+ public void setMailingLists(List mailingLists) {
+ wrapped.setMailingLists(mailingLists);
+ }
+
+ public void setManagedVersionMap(Map map) {
+ wrapped.setManagedVersionMap(map);
+ }
+
+ public void setModelVersion(String pomVersion) {
+ wrapped.setModelVersion(pomVersion);
+ }
+
+ public void setName(String name) {
+ wrapped.setName(name);
+ }
+
+ public void setOrganization(Organization organization) {
+ wrapped.setOrganization(organization);
+ }
+
+ public void setOriginalModel(Model originalModel) {
+ wrapped.setOriginalModel(originalModel);
+ }
+
+ public void setPackaging(String packaging) {
+ wrapped.setPackaging(packaging);
+ }
+
+ public void setParent(MavenProject parent) {
+ wrapped.setParent(parent);
+ }
+
+ public void setParentArtifact(Artifact parentArtifact) {
+ wrapped.setParentArtifact(parentArtifact);
+ }
+
+ public void setPluginArtifactRepositories(List pluginArtifactRepositories) {
+ wrapped.setPluginArtifactRepositories(pluginArtifactRepositories);
+ }
+
+ public void setPluginArtifacts(Set pluginArtifacts) {
+ wrapped.setPluginArtifacts(pluginArtifacts);
+ }
+
+ public void setReleaseArtifactRepository(
+ ArtifactRepository releaseArtifactRepository) {
+ wrapped.setReleaseArtifactRepository(releaseArtifactRepository);
+ }
+
+ public void setRemoteArtifactRepositories(List remoteArtifactRepositories) {
+ wrapped.setRemoteArtifactRepositories(remoteArtifactRepositories);
+ }
+
+ public void setReportArtifacts(Set reportArtifacts) {
+ wrapped.setReportArtifacts(reportArtifacts);
+ }
+
+ public void setReporting(Reporting reporting) {
+ wrapped.setReporting(reporting);
+ }
+
+ public void setScm(Scm scm) {
+ wrapped.setScm(scm);
+ }
+
+ public void setSnapshotArtifactRepository(
+ ArtifactRepository snapshotArtifactRepository) {
+ wrapped.setSnapshotArtifactRepository(snapshotArtifactRepository);
+ }
+
+ public void setUrl(String url) {
+ wrapped.setUrl(url);
+ }
+
+ public void setVersion(String version) {
+ wrapped.setVersion(version);
+ }
+
+ @Override
+ public String toString() {
+ return wrapped.toString();
+ }
+
+ public void writeModel(Writer writer) throws IOException {
+ wrapped.writeModel(writer);
+ }
+
+ public void writeOriginalModel(Writer writer) throws IOException {
+ wrapped.writeOriginalModel(writer);
+ }
+
+ public MavenProject getWrapped() {
+ return wrapped;
+ }
+
+}
diff --git a/src/main/resources/announcements/announcement.md.vm b/src/main/resources/announcements/announcement.md.vm
new file mode 100644
index 0000000..db73f62
--- /dev/null
+++ b/src/main/resources/announcements/announcement.md.vm
@@ -0,0 +1,134 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements. See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership. The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied. See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+## Announcement in markdown format (+tag for Postenours)
+
+to:post at implicitly.posterous.com, scala-announce at listes.epfl.ch
+Subject : ${artifactId} ${version} ((tag : maven, scala))
+
+<markdown>
+The ${developmentTeam} is pleased to announce the [${finalName}](${url}) release!
+
+${introduction}
+
+#if ($release.getActions().size() == 0)
+No changes defined in this version.
+#else
+Changes in this version include:
+
+#if ($release.getActions('add').size() !=0)
+New features:
+-------------
+
+#foreach($actionItem in $release.getActions('add'))
+#set($action=$actionItem.getAction())
+#if ($actionItem.getIssue())
+#set($issue=$actionItem.getIssue())
+#else
+#set($issue="")
+#end
+#if ($actionItem.getDueTo())
+#set($dueto=$actionItem.getDueTo())
+#else
+#set($dueto="")
+#end
+* ${action} #if($!issue != "") Issue: $issue. #end#if($!dueto != "")Thanks to $dueto. #end
+
+#set($issue="")
+#set($dueto="")
+#end
+#end
+
+#if ($release.getActions('fix').size() !=0)
+Fixed Bugs:
+-----------
+
+#foreach($actionItem in $release.getActions('fix'))
+#set($action=$actionItem.getAction())
+#if ($actionItem.getIssue())
+#set($issue=$actionItem.getIssue())
+#else
+#set($issue="")
+#end
+#if ($actionItem.getDueTo())
+#set($dueto=$actionItem.getDueTo())
+#else
+#set($dueto="")
+#end
+* ${action} #if($!issue != "") Issue: $issue. #end#if($!dueto != "")Thanks to $dueto. #end
+
+#set($issue="")
+#set($dueto="")
+#end
+#end
+
+#if ($release.getActions('update').size() !=0)
+Changes:
+--------
+
+#foreach($actionItem in $release.getActions('update'))
+#set($action=$actionItem.getAction())
+#if ($actionItem.getIssue())
+#set($issue=$actionItem.getIssue())
+#else
+#set($issue="")
+#end
+#if ($actionItem.getDueTo())
+#set($dueto=$actionItem.getDueTo())
+#else
+#set($dueto="")
+#end
+* ${action} #if($!issue != "") Issue: $issue. #end#if($!dueto != "")Thanks to $dueto. #end
+
+#set($issue="")
+#set($dueto="")
+#end
+#end
+
+#if ($release.getActions('remove').size() !=0)
+Removed:
+--------
+
+#foreach($actionItem in $release.getActions('remove'))
+#set($action=$actionItem.getAction())
+#if ($actionItem.getIssue())
+#set($issue=$actionItem.getIssue())
+#else
+#set($issue="")
+#end
+#if ($actionItem.getDueTo())
+#set($dueto=$actionItem.getDueTo())
+#else
+#set($dueto="")
+#end
+* ${action} #if($!issue != "") Issue: $issue. #end#if($!dueto != "")Thanks to $dueto. #end
+
+#set($issue="")
+#set($dueto="")
+#end
+#end
+## End of main loop
+#end
+#if ($urlDownload)
+
+For a manual installation, you can [download the ${finalName}](${urlDownload})
+#end
+
+Have fun!
+-${developmentTeam}
+
+</markdown>
\ No newline at end of file
diff --git a/src/main/resources/org_scala_tools_maven_cs/scalacs.boot.properties b/src/main/resources/org_scala_tools_maven_cs/scalacs.boot.properties
new file mode 100644
index 0000000..3d21292
--- /dev/null
+++ b/src/main/resources/org_scala_tools_maven_cs/scalacs.boot.properties
@@ -0,0 +1,22 @@
+[scala]
+ version: 2.7.7
+
+[app]
+ org: ${scalacs.groupId}
+ name: ${scalacs.artifactId}
+ version: ${scalacs.version}
+ class: net_alchim31_scalacs.Main4Launch
+ cross-versioned: false
+
+[repositories]
+ local
+ maven-local
+ sonatype-github: http://oss.sonatype.org/content/repositories/github
+ maven-central
+ scala-tools-releases
+
+[boot]
+ directory: ${scalacs.directory}
+
+[log]
+ level: info
\ No newline at end of file
diff --git a/src/site/site.xml b/src/site/site.xml
new file mode 100644
index 0000000..7c15f4f
--- /dev/null
+++ b/src/site/site.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<project name="${project.name}">
+ <bannerLeft>
+ <name>${project.name}</name>
+ <href>${project.url}</href>
+ </bannerLeft>
+ <bannerRight>
+ <name>Scala-lang</name>
+ <href>http://www.scala-lang.org/</href>
+ <src>http://www.scala-lang.org/images/scala_logo.png</src>
+ </bannerRight>
+ <publishDate position="left" format="yyyy-MM-dd HH:mm" />
+ <version position="left"/>
+ <skin>
+ <groupId>org.scala-tools.skins</groupId>
+ <artifactId>scala-skin-simple</artifactId>
+ <version>1.0</version>
+ </skin>
+ <poweredBy>
+ <logo name="Build with Maven 2" href="http://maven.apache.org" img="images/logos/maven-feather.png" />
+ </poweredBy>
+
+ <body>
+ <links>
+ <item name="Wiki" href="http://wiki.github.com/davidB/maven-scala-plugin/"/>
+ <item name="FAQ" href="http://wiki.github.com/davidB/maven-scala-plugin/frequently-asked-questions"/>
+ <item name="Mailing-list" href="http://groups.google.com/group/maven-and-scala"/>
+ </links>
+ <menu name="Overview">
+ <item name="Introduction" href="index.html" />
+ <item name="Goals" href="plugin-info.html" />
+ <item name="Usage" href="usage.html" />
+ <item name="FAQ" href="faq.html" />
+ </menu>
+ <menu name="Examples">
+ <item name="Compiling" href="example_compile.html" />
+ <item name="Continuous Compilation" href="example_cc.html" />
+ <item name="Continuous Testing" href="example_cctest.html" />
+ <item name="Scaladoc" href="example_doc.html" />
+ <item name="Running" href="example_run.html" />
+ <item name="Scripting" href="example_script.html" />
+ <item name="Scala Console" href="example_console.html" />
+ <item name="Mixed Java/Scala Projects" href="example_java.html" />
+ <item name="Creating Scalac Plugins" href="example_scalac_plugins.html" />
+ <item name="Articles..." href="articles.html" />
+ </menu>
+ <menu ref="reports" />
+ <menu ref="modules" />
+ </body>
+</project>
diff --git a/src/site/xdoc/articles.xml b/src/site/xdoc/articles.xml
new file mode 100644
index 0000000..ba86603
--- /dev/null
+++ b/src/site/xdoc/articles.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document>
+ <properties>
+ <title>maven-scala-plugin : Articles</title>
+ <authors>
+ <person name="David Bernard"/>
+ </authors>
+ </properties>
+ <body>
+ <section name="Articles...">
+ <ul>
+ <li>[2010-06-05 en] <a href="https://www.assembla.com/wiki/show/scala-ide/Using_Maven_with_the_Scala_IDE_for_Eclipse">Using Maven with the Scala IDE for Eclipse</a></li>
+ <li>[2010-03-24 en] <a href="http://mackaz.de/111">Build a mixed Scala 2.8/Java application from scratch with Maven</a></li>
+ <li>[2009-09-27 fr] <a href="http://www.scala-fr.org/initialiser-un-nouveau-projet-scala-avec-maven-2">Initialiser un nouveau projet Scala avec Maven 2</a></li>
+ <li>[2008-01-04 en] <a href="http://www.scala-blogs.org/2008/01/maven-for-scala.html">maven for scala</a></li>
+ </ul>
+ </section>
+ </body>
+</document>
diff --git a/src/site/xdoc/example_cc.xml b/src/site/xdoc/example_cc.xml
new file mode 100644
index 0000000..b3d9c51
--- /dev/null
+++ b/src/site/xdoc/example_cc.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document>
+ <properties>
+ <title>maven-scala-plugin</title>
+ <authors>
+ <person name="David Bernard" />
+ </authors>
+ </properties>
+ <body>
+ <h1>Continuous Compilation of Scala sources</h1>
+
+ <span>Prerequis : <a href="usage.html">common usages</a></span>
+
+ <section>
+ <p>
+ If you want a continuous compilation of sources under src/main and src/test (compilation when file are saved) :
+ <source>
+ <![CDATA[
+mvn scala:cc
+ ]]>
+ </source>
+ </p>
+ <ul>
+ <li>Compilation runs in a infinite loop and compiles only modified files (non-stop), so use Ctrl+C to stop it</li>
+ <li>If you want to compile without FSC (with regular scalac like non-continuous compilation) :
+ <source>
+ <![CDATA[
+mvn scala:cc -Dfsc=false
+ ]]>
+ </source>
+ </li>
+ <li>If you want to display command used to run scala :
+ <source>
+ <![CDATA[
+mvn scala:cc -DdisplayCmd=true
+ ]]>
+ </source>
+ </li>
+ <li style="color:red">WARNING : continuous compilation is an infinite loop so, avoid call the goal "cc" in pom.xml or to connect it to a lifecycle's phase.</li>
+ </ul>
+ </section>
+ </body>
+</document>
diff --git a/src/site/xdoc/example_cctest.xml b/src/site/xdoc/example_cctest.xml
new file mode 100644
index 0000000..df7e078
--- /dev/null
+++ b/src/site/xdoc/example_cctest.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document>
+ <properties>
+ <title>maven-scala-plugin</title>
+ <authors>
+ <person name="James Strachan" />
+ </authors>
+ </properties>
+ <body>
+ <h1>Continuous Testing of Scala sources</h1>
+
+ <span>Prerequisite : <a href="usage.html">common usages</a></span>
+
+ <section name="Running all tests">
+ <p>
+ If you want continuous testing of sources under src/main and src/test (files are compiled when they are saved then tests are run whenever a compile succeeds) :
+ <source><![CDATA[mvn scala:cctest]]></source>
+ </p>
+ <ul>
+ <li>Compilation runs in a infinite loop and compiles only modified files (non-stop), so use Ctrl+C to stop it</li>
+ <li>Tests are run if the compile succeeds</li>
+ <li>If you want to compile without FSC (with regular scalac like non-continuous compilation) :
+ <source><![CDATA[mvn scala:cctest -Dfsc=false]]></source>
+ </li>
+ </ul>
+ </section>
+ <section name="Running a subset of tests">
+ <p>To run only a single test each time or test cases matching a particular pattern, supply the <b>test</b> parameter
+ (like the <a href="http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#test">surefire:test goal</a>)
+ <source><![CDATA[mvn scala:cctest -Dtest=MyTest]]></source>
+ </p>
+ </section>
+ <section name="Summary of test failures">
+ <p>To get useful output when tests fail (like SBT does by default) please make sure you have configured the surefire plugin
+ to set <a href="http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#useFile">useFile</a> to false (or to use a maven property in the configuration of the useFile so you can override on the command line) then you get a reasonable report on the console when tests fail; showing the failed assertion and stack traces etc. So adding something like the following to your pom.xml
+ <source><![CDATA[
+<plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>once</forkMode>
+ <useFile>false</useFile>
+ </configuration>
+</plugin>
+ ]]></source>
+ </p>
+ </section>
+ <section name="Running ScataTest tests">
+ <p>The <b>ccTestGoals</b> parameter can be used to run tests with a different plugin other than the surefire plugin. For example ScalaTest tests can be executed using the <a href="https://github.com/teigen/maven-scalatest-plugin">maven-scalatst-plugin</a>.
+ To execute continuous tests using the maven-scalatest-plugin, first make sure that the maven-scalatest-plugin is configured in your pom.xml. Then, set the ccTestGoals parameter to execute the `scalatest:test` goal.
+ </p>
+ <p>From the command line:
+ <source><![CDATA[mvn -Dcctest.goals=scalatest:test scala:cctest]]></source>
+ </p>
+ <p>If you plan to execute ScalaTest often, you can also set the parameter in your pom.xml:
+ <source><![CDATA[
+<plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <configuration>
+ <ccTestGoals>scatatest:test</ccTestGoals>
+ </configuration>
+</plugin>
+ ]]></source>
+ </p>
+ <p>The ccTestGoals parameter takes a space-seperated list of goals. Thus, it is possible to run both JUnit tests and ScalaTest tests:
+ <source><![CDATA[mvn -Dcctest.goals="surefire:test scalatest:test" scala:cctest]]></source>
+ </p>
+ </section>
+ <section name="Note">
+ <p>If you want to display command used to run scala :
+ <source><![CDATA[mvn scala:cctest -DdisplayCmd=true]]></source>
+ </p>
+ <ul>
+ <li style="color:red">WARNING : continuous compilation is an infinite loop so, avoid call the goal "cctest" in pom.xml or to connect it to a lifecycle's phase.</li>
+ </ul>
+ </section>
+ </body>
+</document>
diff --git a/src/site/xdoc/example_compile.xml b/src/site/xdoc/example_compile.xml
new file mode 100644
index 0000000..2bcd599
--- /dev/null
+++ b/src/site/xdoc/example_compile.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document>
+ <properties>
+ <title>maven-scala-plugin</title>
+ <authors>
+ <person name="David Bernard" />
+ </authors>
+ </properties>
+ <body>
+ <h1>Compiling Scala sources</h1>
+
+ <span>Prerequis : <a href="usage.html">common usages</a></span>
+
+ <section name="Compiling">
+ <p>
+ Place scala sources files in :
+ <source>src/main/scala</source>
+ </p>
+ <p>
+ Place scala test sources files in :
+ <source>src/test/scala</source>
+ </p>
+ <p>
+ Then use the standard maven phases :
+ <source>
+ <![CDATA[
+# compile only
+mvn compile
+# or compile and test
+mvn test
+# or compile, test and package
+mvn package
+ ]]>
+ </source>
+ </p>
+ <p>
+ Or the plugin specifics goal :
+ <source>
+ <![CDATA[
+# compile source
+mvn scala:compile
+# compile test
+mvn scala:testCompile
+ ]]>
+ </source>
+ </p>
+ <p>
+ Or if you want to compile only source (from main and test) without calling previous phases like check resources, generate-sources,... :
+ <source>
+ <![CDATA[
+# compile source and test with fsc
+mvn scala:cc -Donce=true
+# compile source and test with scalac
+mvn scala:cc -Donce=true -Dfsc=false
+ ]]>
+ </source>
+ WARNING:
+ <ul>
+ <li>This feature is provide for integration with editor.</li>
+ <li>using once and fsc => reuse server if previously started else start a new one but never stop it (except if you call scala:cc without -Donce=true, or if you kill the process yourself)</li>
+ </ul>
+ </p>
+ </section>
+ <section name="Increasing memory">
+ <source>
+ <![CDATA[
+<project>
+ ...
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <jvmArgs>
+ <jvmArg>-Xms64m</jvmArg>
+ <jvmArg>-Xmx1024m</jvmArg>
+ </jvmArgs>
+ </configuration>
+ </plugin>
+ ...
+</project>
+ ]]>
+ </source>
+ </section>
+ <section name="Emacs user">
+ <p>If you are an emacs user, you could try the to run the compilation with "-DemacsMode=true" then compilation error will be displayed without [WARNING] at the begin of the line like :
+ <source><![CDATA[
+[INFO] Compiling 1 source files to /home/dwayne/work/oss/scala-tools/vscaladoc/target/classes
+[WARNING] Compilation failure
+
+/project/src/main/scala/org/example/Main.scala:12: error: expected class or object definition
+foo()
+^
+one error found
+ ]]></source>
+ </p>
+ </section>
+
+ <section name="Compiler Arguments">
+ <p>It is common to wish to send arguments to the scalac compiler during compilation of your project. To do so, make use of the args configuration parameter like so:</p>
+ <source><![CDATA[
+<project>
+ ...
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <configuration>
+ <args>
+ <arg>-unchecked</arg>
+ <arg>-deprecation</arg>
+ <arg>-explaintypes</arg>
+ </args>
+ </configuration>
+ </plugin>
+ ...
+</project>
+ ]]></source>
+ </section>
+ </body>
+</document>
diff --git a/src/site/xdoc/example_console.xml b/src/site/xdoc/example_console.xml
new file mode 100644
index 0000000..d1ba106
--- /dev/null
+++ b/src/site/xdoc/example_console.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document>
+ <properties>
+ <title>Example</title>
+ <authors>
+ <person name="David Bernard"/>
+ </authors>
+ </properties>
+ <body>
+ <h1>Running a scala console</h1>
+
+ <section name="Running">
+ <p>
+ You can start a console with a classpath set with the project dependencies (compile, test, runtime) and compiler classes (main and test):
+ <ol>
+ <li>compile your code (running the console doesn't force to compile:
+ <source>mvn test-compile #or mvn test</source>
+ </li>
+ <li>run the console :
+ <source>mvn scala:console</source>
+ </li>
+ <li>when the scala prompt is shown, play :
+ <source><![CDATA[
+...
+[INFO] [scala:console]
+Welcome to Scala version 2.6.0-final.
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> print("hello")
+hello
+scala> new bootstrap.liftweb.Boot().boot
+...
+ ]]></source>
+ </li>
+ </ol>
+ </p>
+ </section>
+
+ <section name="pre/post action">
+ <p>If you want to always run some code before use the console or after use it, and don't want to type it at every startup. Then you could wrap the console into a scala main().</p>
+ <p>I'll show an example with the LiftConsole. A good pratice is to put this class in the test directory (it's not part of the main code ;) )</p>
+ <ol>
+ <li>add into the pom.xml the jar with the scala 's console
+ <source><![CDATA[
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-compiler</artifactId>
+ <version>${scala.version}</version>
+ <scope>test</scope>
+ </dependency>
+ ]]></source>
+ </li>
+ <li>create the scala file src/test/scala/LiftConsole.scala (based on liftrepl)
+ <source><![CDATA[
+import bootstrap.liftweb.Boot
+import scala.tools.nsc.MainGenericRunner
+
+object LiftConsole {
+ def main(args : Array[String]) {
+ // Instantiate your project's Boot file
+ val b = new Boot();
+ // Boot your project
+ b.boot;
+ // Now run the MainGenericRunner to get your repl
+ MainGenericRunner.main(args)
+ // After the repl exits, then exit the scala script
+ exit(0)
+ }
+}
+ ]]></source>
+ </li>
+ <li>compile: <source><![CDATA[mvn test]]></source></li>
+ <li>run : <source><![CDATA[mvn scala:console -DmainConsole=LiftConsole]]></source></li>
+ <li>if you don't want to always need to set "-DmainConsole=LiftConsole",
+ then edit your pom.xml and add to the configuration of the plugin :
+ <source><![CDATA[
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ ...
+ <configuration>
+ <mainConsole>LiftConsole</mainConsole>
+ </configuration>
+ </plugin>
+ ]]></source>
+ </li>
+ </ol>
+
+ </section>
+
+ <section name="running with JavaRebel">
+ <p>If you want to run the console with <a href="">JavaRebel</a>, you need :
+ <ol>
+ <li>install javarebel somewhere on your disk, javarebel is available on a public maven repository (commercial tool)</li>
+ <li>call the console with the option define where is the javarebel.jar:
+ <source>mvn scala:console -Djavarebel.jar.path=[path_of_javarebel.jar]</source>
+ or through the pom.xml
+ <source><![CDATA[
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ ...
+ <configuration>
+ <javaRebelPath>${user.home}/lib/java/javarebel/javarebel.jar</javaRebelPath>
+ </configuration>
+ </plugin>
+ ]]></source>
+ </li>
+ <li><b>NOTE</b> - Forking is currently disabled in the plugin due to cross-platform issues with jline and process indirection.
+ If you wish to use JRebel with the console, please set your maven opts in your environment:
+ <source>MAVEN_OPTS="$MAVEN_OPTS -noverify -javaagent:/...path/to/jrebel.jar" mvn scala:console</source>
+ </li>
+ </ol>
+ </p>
+ </section>
+ </body>
+</document>
diff --git a/src/site/xdoc/example_doc.xml b/src/site/xdoc/example_doc.xml
new file mode 100644
index 0000000..6283566
--- /dev/null
+++ b/src/site/xdoc/example_doc.xml
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document>
+ <properties>
+ <title>Generating API with ScalaDoc</title>
+ <authors>
+ <person name="David Bernard" />
+ </authors>
+ </properties>
+ <body>
+ <h1>Generating API with ScalaDoc</h1>
+
+ <span>Prerequis : <a href="usage.html">common usages</a></span>
+
+ <section name="Configuration">
+ <p>to generate apidocs / scaladoc for your scala sources, add this to your pom.xml</p>
+ <h2>with maven 2.x</h2>
+ <source><![CDATA[
+<project>
+ ...
+ <reporting>
+ <plugins>
+ ...
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ </plugin>
+ ...
+ </plugins>
+ </reporting>
+ ...
+</project>]]></source>
+ <h2>with maven 3.x</h2>
+ <source><![CDATA[
+<project>
+ ...
+ <build>
+ ...
+ <plugins>
+ ...
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.0-beta-2</version>
+ <configuration>
+ <reportPlugins>
+ <plugin>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>2.14.2-SNAPSHOT</version>
+ <configuration>
+ <jvmArgs>
+ <jvmArg>-Xms64m</jvmArg>
+ <jvmArg>-Xmx1024m</jvmArg>
+ </jvmArgs>
+ </configuration>
+ </plugin>
+ ...
+ </reportPlugins>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ ...
+</project>]]></source>
+
+ </section>
+ <section name="To generate api">
+ <p>
+ Place scala sources files in :
+ <source>src/main/scala</source>
+ </p>
+ <p>
+ Then use the standard maven phases :
+ <source>
+ <![CDATA[
+# generate a site
+mvn site
+ ]]>
+ </source>
+ </p>
+ <p>
+ Or the plugin specifics goal :
+ <source>
+ <![CDATA[
+# generate only the doc
+mvn scala:doc
+ ]]>
+ </source>
+ </p>
+ <p>See the result under target/site/scaladocs/</p>
+ </section>
+ <section name="To use a custom api generator">
+ <p>
+ You need to declare the main class to call (with the same parameter as scaladoc). And you need to list the additional artifact(jar) to use :
+ <source><![CDATA[
+<configuration>
+ <scaladocClassName>org.scala_tools.vscaladoc.Main</scaladocClassName>
+ <scalaJars>
+ <scalaJar>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>vscaladoc</artifactId>
+ <version>1.0</version>
+ </scalaJar>
+ </scalaJars>
+</configuration>
+ ]]></source>
+ </p>
+ <p>
+ Then use the standard maven phases :
+ <source>
+ <![CDATA[
+# generate a site
+mvn site
+# or generate only the doc
+mvn scala:doc
+ ]]>
+ </source>
+ </p>
+ <p>See the result under target/site/scaladocs/</p>
+ </section>
+ <section name="To use vscaladoc">
+ <p>
+ vscaladoc have a shortcut way to use it (instead of using the custom way describe above) :
+ <source><![CDATA[
+<configuration>
+ <vscalaVersion>1.0</vscalaVersion>
+</configuration>
+ ]]></source>
+ </p>
+ <p>
+ Then use the standard maven phases :
+ <source>
+ <![CDATA[
+# generate a site
+mvn site
+# or generate only the doc
+mvn scala:doc
+ ]]>
+ </source>
+ </p>
+ <p>See the result under target/site/scaladocs/</p>
+ </section>
+ </body>
+</document>
diff --git a/src/site/xdoc/example_java.xml b/src/site/xdoc/example_java.xml
new file mode 100644
index 0000000..4dce02c
--- /dev/null
+++ b/src/site/xdoc/example_java.xml
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document>
+ <properties>
+ <title>maven-scala-plugin</title>
+ <authors>
+ <person name="Josh Suereth" />
+ </authors>
+ </properties>
+ <body>
+ <h1>Mixed Java/Scala Projects</h1>
+
+ <span>Prerequisites : <a href="usage.html">common usages</a></span>
+
+ <section name="setup">
+ <p>
+ Place java sources files in :
+ <source>src/main/java</source>
+ </p>
+ <p>
+ Place java test sources files in :
+ <source>src/test/java</source>
+ </p>
+ <p>
+ Place scala sources files in :
+ <source>src/main/scala</source>
+ </p>
+ <p>
+ Place scala test sources files in :
+ <source>src/test/scala</source>
+ </p>
+ <p>Make your pom file look similar to the following (this is what we use for integration testing):
+ <source>
+ <![CDATA[
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.scala-tools.maven-scala-plugin</groupId>
+ <artifactId>testJavaAndScala</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Test for Java + Scala compilation</name>
+ <description>Test for Java + Scala compilation</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>2.7.2</version>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>2.9.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>scala-compile-first</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>add-source</goal>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>scala-test-compile</id>
+ <phase>process-test-resources</phase>
+ <goals>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
+
+ ]]>
+ </source>
+ </p>
+ <p>
+ Then use the standard maven phases :
+ <source>
+ <![CDATA[
+# compile only
+mvn compile
+# or compile and test
+mvn test
+# or compile, test and package
+mvn package
+ ]]>
+ </source>
+ </p>
+
+ </section>
+
+ </body>
+</document>
diff --git a/src/site/xdoc/example_run.xml b/src/site/xdoc/example_run.xml
new file mode 100644
index 0000000..3281f67
--- /dev/null
+++ b/src/site/xdoc/example_run.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document>
+ <properties>
+ <title>Example</title>
+ <authors>
+ <person name="Brice Lambi"/>
+ </authors>
+ </properties>
+ <body>
+ <h1>Running a "main(args: Array[String])"</h1>
+
+ <div class="warning">
+ You must have a well define project, and it must compile your code successfully before (see
+ <a href="usage_compile.html">Compiling</a>
+ ).
+ </div>
+ <section name="Running">
+ <p>
+ So you can now run your scala app by defining the "mainClass" property :
+ <source>mvn scala:run -DmainClass=org.example.MyClass</source>
+ </p>
+ </section>
+ <section name="Using Launcher">
+ <p>You need to use launchers if you :
+ <ul>
+ <li>need to specify args and/or jvmArgs that are different from the main configuration</li>
+ <li>run and run again the same "configuration"/command line</li>
+ <li>want to store, some configuration for later user, or for sharing with other</li>
+ </ul>
+ </p>
+ <source><![CDATA[
+ <plugin>
+ <groupId>maven</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <configuration>
+ <launchers>
+ <launcher>
+ <id>foo</id>
+ <mainClass>org.example.MyClass</mainClass>
+ <!-- args are optional -->
+ <args>
+ <arg>arg1</arg>
+ </args>
+ <!-- jvmArgs are optional -->
+ <jvmArgs>
+ <jvmArg>-Xmx128m</jvmArg>
+ <jvmArg>-Djava.library.path=...</jvmArg>
+ </jvmArgs>
+ </launcher>
+ <!-- you could define other launcher -->
+ </launchers>
+ </configuration>
+ </plugin>]]>
+ </source>
+ <p>Now you can run the following command to run your launcher (the classpath used is the test classpath).</p>
+ <source>mvn scala:run -Dlauncher=foo</source>
+ <p>If you don't specify launcher or mainClass then the first launcher is used, in your case, the example below is equivalent to the example above.</p>
+ <source>mvn scala:run</source>
+ <p>If you need/which to specify some additional arguments at call time use "-DaddArgs=arg1|arg2|arg3" ('|' is used as separator)</p>
+ <p>Set the property 'displayCmd' to true, to display the command line used</p>
+
+ </section>
+ </body>
+</document>
diff --git a/src/site/xdoc/example_scalac_plugins.xml b/src/site/xdoc/example_scalac_plugins.xml
new file mode 100644
index 0000000..3694b37
--- /dev/null
+++ b/src/site/xdoc/example_scalac_plugins.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document>
+ <properties>
+ <title>Example Scalac plugin project</title>
+ <authors>
+ <person name="Josh Suereth"/>
+ </authors>
+ </properties>
+ <body>
+ <h1>Creating/Using a Scalac plugin</h1>
+ <section name="Project Setup">
+ <p>A scalac maven-based project has the following structure</p>
+ <source>
+project-root/
+ pom.xml
+ src/
+ main/
+ scala/
+ -Your plugin Source Here
+ resources/
+ scalac-plugin.xml
+ </source>
+ <p>Please follow the <a href="http://www.scala-lang.org/node/140">Writing Scala Compiler Plugins</a> tutorial for the content of the project.</p>
+ <p>A scalac plugin should *only* have dependencies on the scala-compiler artifact, and
+ these dependencies should be of type "provided". Here is an example pom for a plugin project:
+ </p>
+ <source><![CDATA[
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>my-test-plugin</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>Dependency Resolution extensions for the scala compiler</name>
+ <repositories>
+ <repository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </pluginRepository>
+ </pluginRepositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-compiler</artifactId>
+ <version>2.7.2</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <sourceDir>src/main/scala</sourceDir>
+ <jvmArgs>
+ <jvmArg>-Xms64m</jvmArg>
+ <jvmArg>-Xmx1024m</jvmArg>
+ </jvmArgs>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>]]>
+ </source>
+ <p>Now you need to make sure you install the plugin project into the local repository.</p>
+ <source>mvn install</source>
+ </section>
+ <section name="Using a scalac plugin">
+ <p>To make use of one or more scalac plugins, you need to declare them inside your pom using the "compilerPlugins" configuration item.</p>
+ <source><![CDATA[
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ ...
+ <configuration>
+ ...
+ <compilerPlugins>
+ <compilerPlugin>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>my-scalac-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </compilerPlugin>
+ </compilerPlugins>
+ </configuration>
+ </plugin>]]>
+ </source>
+ <p>If you need to send arguments to the plugin, this can be done with the "args" confguration tag.</p>
+ </section>
+ </body>
+</document>
\ No newline at end of file
diff --git a/src/site/xdoc/example_script.xml b/src/site/xdoc/example_script.xml
new file mode 100644
index 0000000..6ad1012
--- /dev/null
+++ b/src/site/xdoc/example_script.xml
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document>
+ <properties>
+ <title>Execute Script</title>
+ <authors>
+ <person name="Jesse Eichar" />
+ </authors>
+ </properties>
+ <body>
+ <h1>Running a scala script</h1>
+ <section name="Running a Script Inlined in the pom">
+ <p>
+ This goal allows you to execute a scala script defined in the pom.
+ </p>
+ <source><![CDATA[
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>script</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <script>
+ println ("Hello from pom script :-)")
+ </script>
+ </configuration>
+ </plugin>]]></source>
+ </section>
+ <section name="Running from a Script File">
+ <p>
+ This goal allows you to run a scala script by defining the "script"
+ property:
+ <source>mvn scala:script -DscriptFile=scripts/PrintHello.scala</source>
+ </p>
+ </section>
+ <section name="Running a script as part of a build">
+ <p>Executing a script as part of the build process.</p>
+ <source><![CDATA[
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>script</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <scriptFile>package.scala</scriptFile>
+ </configuration>
+ </plugin>]]></source>
+ </section>
+ <section name="Predefining a script file">
+ <p>Adding the script configuration to your plugin
+ definition.</p>
+ <source><![CDATA[
+ <plugin>
+ <groupId>maven</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <configuration>
+ <scriptFile>pathToScript/MyScript</scriptFile>
+ </configuration>
+ </plugin>]]></source>
+ <p>Now you can run the following command to run your scala app.
+ </p>
+ <source>mvn scala:script</source>
+ </section>
+ <section name="Classpath for running and compiling script">
+ The classpath is define by configuration 'includeScopes', 'excludeScopes', 'addToClasspath'.
+ The possible scopes are : test, compile, system, runtime, plugin. The default rules (since 2.14) is :
+ <ul>
+ <li>embedded script into pom.xml run with 'plugin' scope</li>
+ <li>script read from scriptFile run with 'compile, test, runtime'</li>
+ </ul>
+ </section>
+ <section name="Using the Maven Project from within a script">
+ <p>If the script run within the 'PLUGIN' scope then a scala.maven.model.MavenProjectAdapter object
+ and a org.apache.maven.plugin.logging.Log object will be passed
+ to the script. The Log will have the name "log" and the
+ MavenProjectAdapter will have the name "project"
+ </p><p>
+ The class MavenProjectAdapter is a decorator for the MavenProject class
+ that adds typing to the java.util.Collection and adds
+ apply and update methods for accessing the properties of the project.
+ </p><p>
+ Note: In this scenario the scala.collection.jcl.Conversions._ is imported so
+ that the java.util collections can be treated as Scala collections.
+ </p>
+ <p>Here is an example script using the project</p>
+ <source><![CDATA[
+ <executions>
+ <execution>
+ <id>generate-hello</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>script</goal>
+ </goals>
+ <configuration>
+ <scalaVersion>2.7.7</scalaVersion>
+ <keepGeneratedScript>true</keepGeneratedScript>
+ <script>
+ <![CDATA[
+ println("hello from scala script constructor")
+
+ def run() {
+ import java.io.PrintWriter
+ import scala.collection.jcl.Conversions._
+
+ println("hello from scala script run method")
+ log.info( project("scala.version") )
+ val fo = new PrintWriter("target/hello.txt")
+ try {
+ fo.println(project.getArtifactId())
+ for( d <- project.getDependencies() ) {
+ fo.println (d.getArtifactId)
+ }
+ } finally {
+ fo.close()
+ }
+ }
+ ]]>
+ </script>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>]]></source>
+ </section>
+ <section name="Technical details">
+ <p>
+ This mojo operates by adding a class definition to the start of the script.
+ As a result the script is essentially the initialization of the class.
+ </p>
+ <p>
+ The reason for this is that it allows one to define classes and functions in any
+ order and not worry about '<em>forward reference extends over definition of
+ value _</em>' compile errors.
+ </p>
+ <p>
+ However there is a danger in putting complex code in the constructor of a class and
+ that has to do poor performance because of certain precautions the JVM takes when
+ constructing a class. In order to offer a solution to this this Mojo will look for
+ a run() method after the '<em>virtual</em>' class has been constructed and invokes
+ that method.
+ </p>
+ <p>
+ If this mojo detects that the MavenProjectAdapter class is on the classpath
+ (in otherwords this plugin is a dependency in the scope that the script runs) then
+ the MavenProjectAdapter that decorates the current MavenProject will be passed to
+ the script's construct. The variable name is '<em>project</em>'. The project
+ variable can be used to inspect parameters of the maven project like the properties and
+ dependencies of the project.
+ </p>
+ <p>Here is an example using the run method with the MavenProjectAdapter</p>
+ <source><![CDATA[<script>
+ println ("Hi I shouldn't do any heavy work here...")
+ def run(){
+ println(project.getName+" is the current project")
+ println("Now lets do some serious work! Even multi-threaded programming is allowed.")
+ }
+</script>]]></source>
+ </section>
+ </body>
+</document>
\ No newline at end of file
diff --git a/src/site/xdoc/faq.xml b/src/site/xdoc/faq.xml
new file mode 100644
index 0000000..1e7e4fb
--- /dev/null
+++ b/src/site/xdoc/faq.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document>
+ <properties>
+ <title>Maven Scala Plugin Frequently Asked Questions</title>
+ <authors>
+ <person name="Josh Suereth" />
+ </authors>
+ </properties>
+ <body>
+ <h1>Frequently Asked Questions</h1>
+
+ <section name="Read-Eval-Print-Loop (aka scala:console)">
+ <dl>
+ <dt>Why does maven net let me call scala:console?</dt>
+ <dd>Maven 3.0 made its policy more strict about shortened plugin names. If you wish to use scala:goal forms on the command-line you must create a <pluginGroup> element in your ~/.m2/settings.xml file that contains org.scala-tools as a pluginGroup.
+ </dd>
+ </dl>
+ <dl>
+ <dt>Why does the mvn scala:console goal not compile the project?</dt>
+ <dd>The authors of the plugin felt it was much more flexible to allow a REPL to be started during the coding of a project.
+ The REPL is mostly used for experimenting with APIs and therefore users should not need a functioning project to test out potential code paths.
+ Users who want to make use of their latest changes should type "mvn compile scala:console" or "mvn test-compile scala:console" rather than just "mvn scala:console"</dd>
+ <dt>Does the REPL support auto-complete?</dt>
+ <dd>As of Scala 2.8.0 the REPL supports auto-complete features.</dd>
+
+ </dl>
+ </section>
+
+ <section name="Eclipse Integration">
+ <dl>
+ <dt>Is there a wiki detailing Scala/Eclipse/Maven integration</dt>
+ <dd>Yes, it requires a Scala trac user account and is located <a href="http://lampsvn.epfl.ch/trac/scala/wiki/ScalaEclipseMaven">here</a></dd>
+ <dt>Why does the mvn eclipse:eclipse not add the src/main/scala directory as a source path</dt>
+ <dd>The maven-eclipse-plugin is not maintained/integrated with the maven-scala-plugin.
+ If you would like to have the src/main/scala directory added as a source path in eclipse, you must configure it useing the <a href="http://mojo.codehaus.org/build-helper-maven-plugin/howto.html">maven-build-helper-plugin's add-source goal</a>
+ Example: <pre>
+<project>
+
+ ...
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>src/main/scala</source>
+ ...
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+ </pre>
+ </dd>
+ <dt>Can you synchronize eclipse configuration with the scalac plugin pom configuration?</dt>
+ <dd>Not Currently</dd>
+
+ </dl>
+ </section>
+ </body>
+</document>
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
new file mode 100644
index 0000000..b49f5b9
--- /dev/null
+++ b/src/site/xdoc/index.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document>
+ <properties>
+ <title>maven-scala-plugin</title>
+ <authors>
+ <person name="Brice Lambi"/>
+ <person name="David Bernard"/>
+ </authors>
+ </properties>
+ <body>
+ <section name="maven-scala-plugin">
+ <p>The maven-scala-plugin is used for compiling/testing/running/documenting scala code in maven. The plugin is used by <a href="http://liftweb.net"><i>/Lift/</i></a>.</p>
+ <p>If there are problems please let us know.</p>
+ </section>
+ <section name="Requirements">
+ <ul>
+ <li>Maven 2.0.7</li>
+ <li>JDK 1.5</li>
+ <li><bold>No need to install <a href="http://scala-lang.org">scala</a> !</bold></li>
+ </ul>
+ </section>
+ <p>Thanks to Brice Lambi and the team of the version 1.0 of the plugin. (version 2.x is a 95%/full rewrite)</p>
+ </body>
+</document>
diff --git a/src/site/xdoc/usage.xml b/src/site/xdoc/usage.xml
new file mode 100644
index 0000000..e8d1cf5
--- /dev/null
+++ b/src/site/xdoc/usage.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document>
+ <properties>
+ <title>Using the plugin</title>
+ <authors>
+ <person name="David Bernard" />
+ </authors>
+ </properties>
+ <body>
+ <h1>Using the plugin (common)</h1>
+ <section name="Configuration">
+ <p>to use the plugin you need to add into your pom.xml (the first time you use the plugin, if you don't precise the version like in the following example, call maven with the "-U" option)</p>
+ <source>
+ <![CDATA[
+<project>
+ ...
+ <repositories>
+ <repository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </repository>
+ </repositories>
+ ...
+ <pluginRepositories>
+ <pluginRepository>
+ <id>scala-tools.org</id>
+ <name>Scala-tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </pluginRepository>
+ </pluginRepositories>
+ ...
+ <build>
+ <sourceDirectory>src/main/scala</sourceDirectory>
+ <testSourceDirectory>src/test/scala</testSourceDirectory>
+ ...
+ <plugins>
+ ...
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ ... (see other usage or goals for details) ...
+ </plugin>
+ ...
+ </plugins>
+ ...
+ </build>
+ ...
+</project>
+ ]]>
+ </source>
+ </section>
+
+ <section name="Displaying scala help and version">
+ <source>mvn scala:help</source>
+ </section>
+
+ <section name="Displaying the command line used">
+ <p>Set the property displayCmd to true</p>
+ <source>
+ <![CDATA[
+$> mvn scala:compile -DdisplayCmd=true
+
+[INFO] Scanning for projects...
+[INFO] Searching repository for plugin with prefix: 'scala'.
+[INFO] ----------------------------------------------------------------------------
+[INFO] Building fooA
+[INFO] task-segment: [scala:compile]
+[INFO] ----------------------------------------------------------------------------
+[INFO] [scala:compile]
+[INFO] cmd: /home/dwayne/bin/soft-linux/jdk-1.5.0_07/jre/bin/java -classpath /home/dwayne/.m2/repository/scala/scala-compiler/2.6.0/scala-compiler-2.6.0.jar:/home/dwayne/.m2/repository/scala/scala-library/2.6.0/scala-library-2.6.0.jar scala.tools.nsc.Main -classpath /home/dwayne/work/oss/liftweb-archetypes/fooA/target/classes:/home/dwayne/.m2/repository/scala/scala-library/2.6.0/scala-library-2.6.0.jar -d /home/dwayne/work/oss/liftweb-archetypes/fooA/target/classes -sourcepath /home/dwa [...]
+[INFO] ------------------------------------------------------------------------
+[INFO] BUILD SUCCESSFUL
+[INFO] ------------------------------------------------------------------------
+[INFO] Total time: 5 seconds
+[INFO] Finished at: Sat Nov 10 22:28:54 GMT+01:00 2007
+[INFO] Final Memory: 7M/63M
+[INFO] ------------------------------------------------------------------------
+ ]]>
+ </source>
+ </section>
+
+ <section name="Changing the scala version">
+ <p>
+ Since version 2.7 of the plugin, the scala version to use is detected from dependency to scala-library. So it suggested to not use scalaVersion configuration.
+ But if you want to define explicitly the version of scala used to compile,... use 'scalaVersion', ex:
+ <source>
+ <![CDATA[
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <scalaVersion>${scala.version}</scalaVersion>
+ </configuration>
+ </plugin>
+ ]]>
+ </source>
+ </p>
+ </section>
+
+ </body>
+</document>
diff --git a/src/test/java/org_scala_tools_maven/MiscTest.java b/src/test/java/org_scala_tools_maven/MiscTest.java
new file mode 100644
index 0000000..cc3f871
--- /dev/null
+++ b/src/test/java/org_scala_tools_maven/MiscTest.java
@@ -0,0 +1,29 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org_scala_tools_maven;
+
+import junit.framework.TestCase;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ *
+ * @author david bernard
+ */
+public class MiscTest extends TestCase {
+ public void testJdkSplit() throws Exception {
+ assertEquals(6, "hello".split("|").length);
+ assertEquals(1, "hello".split("\\|").length);
+ assertEquals(2, "hel|lo".split("\\|").length);
+ assertEquals(3, "hel||lo".split("\\|").length);
+ }
+
+ public void testStringUtilsSplit() throws Exception {
+ assertEquals(1, StringUtils.split("hello", "|").length);
+ assertEquals(1, StringUtils.split("hello|", "|").length);
+ assertEquals(2, StringUtils.split("hel|lo", "|").length);
+ assertEquals(2, StringUtils.split("hel||lo", "|").length);
+ }
+}
diff --git a/src/test/java/org_scala_tools_maven/VersionNumberTest.java b/src/test/java/org_scala_tools_maven/VersionNumberTest.java
new file mode 100644
index 0000000..6267183
--- /dev/null
+++ b/src/test/java/org_scala_tools_maven/VersionNumberTest.java
@@ -0,0 +1,37 @@
+package org_scala_tools_maven;
+
+import org_scala_tools_maven.VersionNumber;
+
+import junit.framework.TestCase;
+
+public class VersionNumberTest extends TestCase {
+ public void testCompare() throws Exception {
+ assertEquals(1, new VersionNumber("2.7.1").compareTo(new VersionNumber("1.0")));
+ assertEquals(1, new VersionNumber("2.7.1").compareTo(new VersionNumber("1.9")));
+ assertEquals(1, new VersionNumber("2.7.1").compareTo(new VersionNumber("2.0")));
+ assertEquals(1, new VersionNumber("2.7.1").compareTo(new VersionNumber("2.7")));
+ assertEquals(1, new VersionNumber("2.7.1").compareTo(new VersionNumber("2.7-rc")));
+ assertEquals(1, new VersionNumber("2.7.1").compareTo(new VersionNumber("2.7.0")));
+ assertEquals(0, new VersionNumber("2.7.1").compareTo(new VersionNumber("2.7.1")));
+ assertEquals(-1, new VersionNumber("2.7.1").compareTo(new VersionNumber("2.7.2-rc1")));
+ assertEquals(-1, new VersionNumber("2.7.1").compareTo(new VersionNumber("2.8")));
+ assertEquals(-1, new VersionNumber("2.7.1").compareTo(new VersionNumber("3.0")));
+ }
+ public void testParse() throws Exception {
+ assertParseVN("2.7.1", 2, 7, 1, null);
+ assertParseVN("2.7", 2, 7, 0, null);
+ assertParseVN("2.7.1.RC", 2, 7, 1, ".RC");
+ assertParseVN("2.7.1.RC", 2, 7, 1, ".RC");
+ assertParseVN("2.7.RC", 2, 7, 0, ".RC");
+ assertParseVN("2.7-RC", 2, 7, 0, "-RC");
+ assertParseVN("2.7.1-SNAPSHOT", 2, 7, 1, "-SNAPSHOT");
+ }
+
+ private void assertParseVN(String str, int major, int minor, int bugfix, String modifier ) {
+ VersionNumber v = new VersionNumber(str);
+ assertEquals("test major of " + str, major, v.major);
+ assertEquals("test minor of " + str, minor, v.minor);
+ assertEquals("test bugfix of " + str, bugfix, v.bugfix);
+ assertEquals("test modifier of " + str, modifier, v.modifier);
+ }
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/maven-scala-plugin.git
More information about the pkg-java-commits
mailing list