raby / play2-maven-plugin

Automatically exported from code.google.com/p/play2-maven-plugin
0 stars 0 forks source link

Would be nice to be able to generate apidoc (play doc) and also scoverage #47

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
As written in the title it would be nice to be able to generate play doc and 
scovergage and attach doc to package and scoverage to site/reporting.

Currently I'm doing it like this which is far from optimal ! 

     <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>scaladoc</id>
            <phase>site</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <echo message="Generating ScalaDocs" />
                <exec dir="${basedir}" executable="${PLAY2_HOME}/play" failonerror="true">
                  <arg line="doc" />
                </exec>
                <echo message="Generating ScalaDocs done" />
              </target>
            </configuration>
          </execution>
          <execution>
            <id>scoverage</id>
            <phase>site</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <echo message="Generating Scoverage" />
                <exec dir="${basedir}" executable="${PLAY2_HOME}/play" failonerror="true">
                  <arg line="scoverage:test" />
                </exec>
                <echo message="Generating Scoverage done" />
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>

Thank you !!!

Original issue reported on code.google.com by patrick....@gmail.com on 25 Sep 2014 at 11:09

GoogleCodeExporter commented 9 years ago
Hi Partick

1. Scaladoc

Did you try http://davidb.github.io/scala-maven-plugin/doc-mojo.html?
I don't know Scaladoc, but if it has so many options as Javadoc (look at 
http://maven.apache.org/plugins/maven-javadoc-plugin/), there could be new 
plugin (scaladoc-maven-plugin) for this functionality.

2. Scoverage

This is interesting new coverage tool. There is even Maven plugin 
https://github.com/scoverage/maven-scoverage-plugin, but I see two problems 
here:
- I did not test it yet, but I think that Scoverage plugin will not work with 
my SBT compiler plugin (used in play2 projects) right now because it has no 
compiler plugins 
(https://github.com/scoverage/scoverage-samples/blob/master/pom.xml#L63-L69) 
equivalent yet
- in this example 
https://github.com/scoverage/scoverage-samples/blob/master/pom.xml compilation 
ALWAYS uses scoverage plugin; in contrast Maven Cobertura plugin does not 
instrument classes when not run in context of Cobertura report; I have to look 
at this closer, but at first sight it looks too simple for me :)

Did you try Cobertura? Look at my test projects 
http://play2-maven-plugin.googlecode.com/svn/tags/test-projects-1.0.0-alpha8/rep
orting/cobertura/

Thank you for this issue. I will work on it more, expecially Scoverage looks 
interesting (I'm curious how it compares to Cobertura).

Original comment by gslowiko...@gmail.com on 1 Oct 2014 at 9:09

GoogleCodeExporter commented 9 years ago

Original comment by gslowiko...@gmail.com on 1 Oct 2014 at 9:10

GoogleCodeExporter commented 9 years ago
You can make your pom a little less verbose right now using my new plugin:

     <plugin>
        <groupId>com.google.code.sbtrun-maven-plugin</groupId>
        <artifactId>sbtrun-maven-plugin</artifactId>
        <version>1.0.0-beta2</version>
        <executions>
          <execution>
            <id>scaladoc</id>
            <phase>site</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <args>doc</args>
            </configuration>
          </execution>
          <execution>
            <id>scoverage</id>
            <phase>site</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <args>scoverage:test</args>
            </configuration>
          </execution>
        </executions>
      </plugin>

By the way, can you provide sample project?

Original comment by gslowiko...@gmail.com on 1 Oct 2014 at 11:41

GoogleCodeExporter commented 9 years ago
Sorry, version should be 1.0.0-beta1 not 1.0.0-beta2

Original comment by gslowiko...@gmail.com on 1 Oct 2014 at 1:51

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thank you for your answers!

About scaladoc-maven-plugin yes I tried it but there was an issue with views.

My project is in scala and cobertura wasn't working that well compare to 
scoverage.

I will definitely try your sbtrun-maven-plugin but can it be use as a reporting 
plugin also ?

Cause I forgot to mention that after generating the scaladoc and scoverage 
report I had to move those folders into the site directory before publishing,  
like this:

      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-scaladocs-to-site</id>
            <phase>site</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/site/scoverage-report</outputDirectory>
              <overwrite>true</overwrite>
              <resources>
                <resource>
                  <directory>${project.build.directory}/scoverage-report</directory>
                  <includes>
                    <include>**/*</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>copy-scovergae-to-site</id>
            <phase>site</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory> v/scaladocs</outputDirectory>
              <overwrite>true</overwrite>
              <resources>
                <resource>
                  <directory>${project.build.directory}/api</directory>
                  <includes>
                    <include>**/*</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>

That's why I was wondering if I could use your plugin directly as a reporting 
plugin. So the folders would be generated directly in the 
${project.build.directory}/site and even would be attached to the 'Project 
reports' menu of the maven-site

Thank you again.

Original comment by patrick....@gmail.com on 1 Oct 2014 at 7:39

GoogleCodeExporter commented 9 years ago
Patrick, can you provide sample project showing all these awfully verbose 
configurations? I'm curious, what could I do to simplify it now and in the 
future.

Original comment by gslowiko...@gmail.com on 1 Oct 2014 at 8:04

GoogleCodeExporter commented 9 years ago
I will work on the sample project.

But As I'm at it I'm also doing that to generate rpm 

    <profile>
      <id>with-rpm</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>rpm</id>
                <goals>
                  <goal>run</goal>
                </goals>
                <phase>package</phase>
                <configuration>
                  <target>
                    <echo message="Generating rpm" />
                    <exec dir="${basedir}" executable="${PLAY2_HOME}/play" failonerror="true">
                      <arg line="rpm:packageBin" />
                    </exec>
                    <fileset id="rpm-file" dir="${basedir}/target/rpm/RPMS/noarch/" />
                    <echo message="Attaching generated rpm: ${ant.refid:rpm-file}" />
                    <attachartifact file="${basedir}/target/rpm/RPMS/noarch/${ant.refid:rpm-file}" type="rpm" />
                    <echo message="Generating rpm done" />
                  </target>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

my mvn command to generate everything is

mvn clean deploy site site:deploy -P with-rpm

Original comment by patrick....@gmail.com on 1 Oct 2014 at 8:50

GoogleCodeExporter commented 9 years ago
I just moved to play 2.3.5  and scala 2.11.2. I didn't forget the sample 
project.

Original comment by patrick....@gmail.com on 15 Oct 2014 at 11:09

GoogleCodeExporter commented 9 years ago
I hope, moving to different Scala and Play! version in Maven took 5 minutes.

When will sample project be ready?

BTW, you can check my new plugin for SCoverage 
https://code.google.com/p/scoverage-maven-plugin/. The original one 
(https://github.com/scoverage/maven-scoverage-plugin) is not usable.

Original comment by gslowiko...@gmail.com on 16 Oct 2014 at 7:14

GoogleCodeExporter commented 9 years ago
Did you see this Maven RPM plugin http://mojo.codehaus.org/rpm-maven-plugin/ ?

Original comment by gslowiko...@gmail.com on 16 Oct 2014 at 9:06

GoogleCodeExporter commented 9 years ago
The sample project:
https://github.com/PatrickSauts/play235-scala211-scoverage-rpm-site

Original comment by patrick....@gmail.com on 20 Oct 2014 at 10:19

GoogleCodeExporter commented 9 years ago
I tried the maven RPM plugin but I didn't find any plugin like 
sbt-native-package which does most of what is needed for RPMs

Original comment by patrick....@gmail.com on 20 Oct 2014 at 10:37

GoogleCodeExporter commented 9 years ago
I'm trying your scoverage plugin now

Original comment by patrick....@gmail.com on 20 Oct 2014 at 10:55

GoogleCodeExporter commented 9 years ago
Is there a way to generate html reports like mvn scoverage:report-html

Cobertura does it like this

<plugin>
<groupId>org.codehaus.mojo</groupId> 
<artifactId>cobertura-maven-plugin</artifactId> <configuration>
<formats>
<format>html</format>
</formats>
</configuration>
</plugin>

Original comment by patrick....@gmail.com on 20 Oct 2014 at 11:41

GoogleCodeExporter commented 9 years ago
I can't manage to produce html reports with 
https://code.google.com/p/scoverage-maven-plugin/

Original comment by patrick....@gmail.com on 20 Oct 2014 at 11:52

GoogleCodeExporter commented 9 years ago
Check my SCoverage fixes in your test project:
https://github.com/gslowikowski/play235-scala211-scoverage-rpm-site/commit/e0014
729cf4113e3b71db8f8d6ba211ceb2788a3

Lates snapshot versions of sbt-compiler-maven-plugin and play2-maven-plugin are 
required to cooperate properly with scoverage-maven-plugin.

Original comment by gslowiko...@gmail.com on 21 Oct 2014 at 10:29

GoogleCodeExporter commented 9 years ago
And 
https://github.com/gslowikowski/play235-scala211-scoverage-rpm-site/commit/47f09
7f4086990c75091fe0102b80ebb8a0c7944

Original comment by gslowiko...@gmail.com on 21 Oct 2014 at 10:50

GoogleCodeExporter commented 9 years ago
ScalaDoc configuration changes: 
https://github.com/gslowikowski/play235-scala211-scoverage-rpm-site/commit/db437
b6fb0df59e7c446b81e5771f611d01fc87f

Original comment by gslowiko...@gmail.com on 21 Oct 2014 at 1:01

GoogleCodeExporter commented 9 years ago
Awesome ! Thank you !

Everything is working like a charm and it's a lot neater.

Original comment by patrick....@gmail.com on 21 Oct 2014 at 6:24

GoogleCodeExporter commented 9 years ago
I'm glad.

BTW, today I found this project: https://github.com/shivawu/sbt-maven-plugin
Did you see it? It does something similar you do in SBT.

Original comment by gslowiko...@gmail.com on 21 Oct 2014 at 6:29

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I'll try sbt-maven-plugin thank you

Original comment by patrick....@gmail.com on 21 Oct 2014 at 6:38

GoogleCodeExporter commented 9 years ago
So sbt-maven-plugin has to many restrictions and doesn't work very well with 
dependencies.

I updated the sample project now that I've reached something neat enough. many 
thanks to you

have a look
https://github.com/PatrickSauts/play235-scala211-scoverage-rpm-site

and let me know what you think.

Original comment by patrick....@gmail.com on 29 Oct 2014 at 10:36

GoogleCodeExporter commented 9 years ago
Hi, sorry for delay.

1. you need:
  <play2.plugin.version>1.0.0-alpha9-SNAPSHOT</play2.plugin.version>
and
  <sbt-compiler.plugin.version>1.0.0-beta5-SNAPSHOT</sbt-compiler.plugin.version>
I will cut releases soon, earlier versions does not work with scoverage plugin

2. I've just added a little improvement
https://code.google.com/p/scoverage-maven-plugin/source/detail?r=74
IMO scoverage configuration should look like:
    <configuration>
     <excludedPackages>com.github.views.html.*|(empty)</excludedPackages>    <excludedFiles>.*?routes_(routing|reverseRouting);.*?.LoggingFilter</excludedFiles>
     <highlighting>true</highlighting>
    </configuration>
and you don't need "(empty)", so:
     <excludedPackages>com.github.views.html.*</excludedPackages>    
would be sufficient.

Original comment by gslowiko...@gmail.com on 7 Nov 2014 at 12:02

GoogleCodeExporter commented 9 years ago
I'll do the changes according to your comment, thank you.

There is something though, now I've got this error

[ERROR] Failed to execute goal 
com.google.code.play2-maven-plugin:play2-maven-plugin:1.0.0-alpha9-SNAPSHOT:rout
es-compile (default-routes-compile) on project rbcserver: Provider 
autodetection failed: Could not find artifact 
com.google.code.play2-maven-plugin:play2-provider-play23:jar:1.0.0-alpha9-201411
13.145052-5 

Original comment by patrick....@hotschedules.com on 17 Nov 2014 at 7:47

GoogleCodeExporter commented 9 years ago
I've released: sbt-compiler-1.0.0-beta5, play2-1.0.0-alpha9 and 
scoverage-1.0.0-alpha1 and snapshots disappeared automatically.

I'm working on documentation and release notes, so haven't announced it yet.

Sorry.

Original comment by gslowiko...@gmail.com on 17 Nov 2014 at 9:37

GoogleCodeExporter commented 9 years ago
ok thank you. I'm using the release from now one.

Original comment by patrick....@hotschedules.com on 17 Nov 2014 at 10:32

GoogleCodeExporter commented 9 years ago
SCoverage plugin moved to GitHub. Check old GoogleCode location for more info.

I'm closing this issue with "WontFix" status, because nothing had to be changed 
in Play2 plugin.

Original comment by gslowiko...@gmail.com on 4 Dec 2014 at 9:19