How to generate symbol map in gwt using maven? - maven

I want to generate symbol map file in gwt using maven commandline option? I tried with -extra WEB-INF/classses but its not working.

Basically you want to specify maven plugin configuration values/options.
Here you have the general approach: LINKE
Besides that you have to know the plugin prefix that you can find on the GWT plugin page (there are several GWT maven plugins)
EDIT: added a gwt plugin example:
Just define the ${} snippets in your gwt property section and you will be fine.
<!-- The GWT compiler configuration
References:
Plugin: http://mojo.codehaus.org/gwt-maven-plugin
Optimizing the build: http://www.sencha.com/blog/using-the-gwt-compiler-for-better-builds
System properties: https://code.google.com/p/google-web-toolkit/wiki/JavaSystemPropertiesAndGwt
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<id>bla</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<module>com.bla.BlaProd</module>
<mode>htmlunit</mode>
<draftCompile>false</draftCompile>
<disableClassMetadata>true</disableClassMetadata>
<compileReport>true</compileReport>
<warSourceDirectory>${gwt.war}</warSourceDirectory>
<webappDirectory>${gwt.output.bla}</webappDirectory>
<gen>${gwt.output.bla}/${gwt.gen}</gen>
<extra>${gwt.output.bla}/${gwt.extra}</extra>
<fragmentCount>8</fragmentCount>
<extraJvmArgs>-Xms1G -Xmx1G -Xss1024k -XX:MaxPermSize=1024m -Dgwt.persistentunitcache=false</extraJvmArgs>
<localWorkers>4</localWorkers>
</configuration>
</execution>
</executions>
</plugin>

Related

How to specify output format for jacoco plugin for maven?

I have a maven project with jacoco plugin, which generates reports in different formats, such as html, csv and xml. But I need only html. How can I specify it?
Here is some code, where I add jacoco plugin:
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.plugin.version}</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
//other plugins
</plugins>
</build>
Then I run tests:
mnv clean test
And all reports appears in "target" directory.
I read documentation https://www.eclemma.org/jacoco/trunk/doc/maven.html, but I didn't found anything about how to pick requiring format. I found it only for Ant and Gradle.
I suppose I missing something, so I will be grateful for any clue.
I searched the same thing and stumbled over the following issue with it:
The old path was
target\jacoco\jacoco.report
The XML report however is put into:
target\site\jacoco
and in there are the XML, csv, html ...
As of today report goal of jacoco-maven-plugin unconditionally generates XML, HTML and CSV - see https://github.com/jacoco/jacoco/issues/9
And in my opinion there is no reasons to disable HTML and XML - cost of generation is small, developers can view HTML in place, while XML consumed by other tools such as SonarQube or Jenkins.
As a workaround if highly needed, report task of JaCoCo Ant Tasks can be executed via maven-antrun-plugin.
You can specify the report format to generate by specifying the configuration as follows-
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<configuration>
<!-- Rest of your configuration, if any -->
<formats>HTML</formats>
</configuration>
</plugin>
Note that this is available since version 0.8.7. Useful resource- https://www.jacoco.org/jacoco/trunk/doc/report-integration-mojo.html#formats

Are directions available for the maven plugin com.alexnederlof jasperreports-plugin?

I have read up on the limited information regarding com.alexnederlof jasperreports-plugin and I'm looking to convert my current ant build to use this maven plugin, but there doesn't seem to be any documentation available.
My biggest concern is run-time: If I use this plugin at build-time, what version of jasper-reports do I need to use at run-time?
Am I missing a reference somewhere? As the old adage goes, "If there isn't any documentation, then I guess I'll have to write it."
I am not sure of what you are after but, I am using this plugin in maven to generate the source .jrxml files to .jasper files and the configuration in pom goes like this:
<plugin>
<groupId>com.alexnederlof</groupId>
<artifactId>jasperreports-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>jasper</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- These are the default configurations: -->
<compiler>net.sf.jasperreports.engine.design.JRJdtCompiler</compiler>
<sourceDirectory>src/main/jasperreports</sourceDirectory>
<outputDirectory>${basedir}/src/main/webapp</outputDirectory>
<outputFileExt>.jasper</outputFileExt>
<xmlValidation>true</xmlValidation>
<verbose>false</verbose>
<numberOfThreads>4</numberOfThreads>
<failOnMissingSourceDirectory>true</failOnMissingSourceDirectory>
<sourceScanner>
org.codehaus.plexus.compiler.util.scan.StaleSourceScanner
</sourceScanner>
</configuration>
</plugin>
Hope this helps

Using sonar.test.exclusions with Sonarqube 6.3

I'm currently evaluating Sonarqube 6.3 (a big upgrade from my current 5.5 instance) and I'm getting confused trying to work out the functionality of the sonar.test.exclusions setting.
There's this question: Sonar Maven Plugin: How do I exclude test source directories? which seems to indicate that it is used to exclude test files from analysis (which is what I'm after - I don't want my sonar ruleset run over my unit tests). The documentation https://docs.sonarqube.org/display/SONAR/Narrowing+the+Focus also indicates that it is used to 'exclude unit test files' (perhaps this can be expanded upon to make it clearer?)
Thing is, when I add sonar.test.exclusions with a value of **/src/test/** and then run my analysis, I'm still getting code smells and the like being found for:
Foo/src/test/java/foo/bar/BarTest.java
Foo/src/test/java/lah/LahTest.java
etc.
When I use sonar.exclusions instead, they don't show up. Why is sonar.test.exclusions not doing what I expect?
First of all: if you have a Maven project, you should use the scanner for Maven (mvn sonar:sonar). It will simplify your configuration, and will automatically register src/test/java folder as a test directory.
Now if you want to do the configuration manually, or understand what is going on under the hood, here is the explanation: SonarQube scanner work with 2 sets of files, main and test. Main source files are configured using the property sonar.sources. Test source files are configured using sonar.tests.
On top of that, you can filter some content using the sonar.[test.]exclusions properties.
In you case your problem is that Foo/src/test/java/foo/bar/BarTest.java seems to be considered as a main source file. That's why sonar.test.exclusions has no effect.
Using maven with verfication goal (mvn clean verify sonar:sonar install), I have used this configuration without problems:
...
<properties>
....
<sonar.exclusions>
**/generated/**/*,
**/model/**/*
</sonar.exclusions>
<sonar.test.exclusions>
src/test/**/*
</sonar.test.exclusions>
....
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath>
<sonar.coverage.exclusions>
**/generated/**/*,
**/model/**/*
</sonar.coverage.exclusions>
<jacoco.version>0.7.5.201505241946</jacoco.version>
....
</properties>
....
Coverage exclusion configuration, inside properties (up) and jacoco plugin configuracion:
.....
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>target/jacoco.exec</dataFile>
<outputDirectory>target/jacoco-ut</outputDirectory>
</configuration>
</execution>
</executions>
<configuration>
<systemPropertyVariables>
<jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
....

How to generate symbolmap in gwt mvp4g project?

I am using Mvp4g on the gwt client side. I want to generate symbolMap that is used by RemoteLogging Servlet but when I try to generate symbol map using mvn clean install and specifying -extra folder_name property in gwt-maven-plugin configuration, I don't see the symbolMap files. It is not a plain gwt app but its gwt with mvp4g. I don't know whether its mvp4g that is causing the problem.
mvp4g generates Java code on the client side. This happens before the compiler translates the code to JavaScript. Check your settings. May be this post helps. How to generate symbol map in gwt using maven?
Update:
I use this maven configuration:
<gwt.output>myPathToTheProjectDirectory/output</gwt.output>
<gwt.gen>genSources</gwt.gen>
<gwt.extra>extra</gwt.extra>
And this for the maven-gwt-plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.6.1</version>
<executions>
<execution>
<phase>compile</phase>
<id>bla</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<draftCompile>false</draftCompile>
<disableClassMetadata>true</disableClassMetadata>
<compileReport>true</compileReport>
<warSourceDirectory>${gwt.war}</warSourceDirectory>
<webappDirectory>${gwt.output}</webappDirectory>
<gen>${gwt.output}/${gwt.gen}</gen>
<extra>${gwt.output}/${gwt.extra}</extra>
<fragmentCount>8</fragmentCount>
<extraJvmArgs>-Xms1G -Xmx1G -Xss1024k -XX:MaxPermSize=1024m -Dgwt.persistentunitcache=false</extraJvmArgs>
<localWorkers>7</localWorkers>
</configuration>
</execution>
</executions>
</plugin>
In case I execute maven:compile, the symbolmaps are listed inside the folder myPathToTheProjectDirectory/output/extra/symbolmaps.
Try add this: <set-property name="compiler.useSourceMaps" value="true" />
It solves the problem for me.

jaxb2-maven-plugin with external XSD dependencies

We have a common set of XSDs (datatypes, vocabulary, etc.) we're generating with the jaxb2-maven-plugin in its own Maven project. In a second project, I need to refer to one or more of those XSDs at compile time but don't want them included in the resulting artifact. I've created a catalog file, which works fine except I get everything in it.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<outputDirectory>${basedir}/src/main/java</outputDirectory>
<target>2.1</target>
<catalog>catalog.cat</catalog>
</configuration>
I've pored over the plugin docs, but they're woefully light on detail. Is there any way to get reuse out of common schemas without every project having to take a copy of them?
Thanks
This is something my maven-jaxb2-plugin can do:
Compiling schema from Maven Artifact
The documentation site is currently very unstable so here's snippets of the documentation.
<configuration>
<forceRegenerate>true</forceRegenerate>
<schemas>
<schema>
<dependencyResource>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin-tests-po</artifactId>
<!-- Can be defined in project dependencies or dependency management -->
<version>${project.version}</version>
<resource>purchaseorder.xsd</resource>
</dependencyResource>
</schema>
</schemas>
</configuration>
Here's a sample project.

Resources