I am trying to make sure that the correct resources are moved to WEB-INF/config/ no matter if I call
mvn gcloud:deploy
or
mvn tomcat7:run
which is why I am enforcing -Dpackage-mode=<value> to be set. I am using the maven-resource-plugin for the copy part like this:
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>src/main/webapp/WEB-INF/config</outputDirectory>
<resources>
<resource>
<directory>src/main/assembly/${package-mode}/config</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
However, if I run
mvn validate tomcat7:run -Dpackage-mode=dev
for starting the server the files are not getting copied.
E:\java\mz\mz-server\mz-web-server>mvn validate tomcat7:run -Denv=dev -Dpackage-mode=dev
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mz-web-server 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven) # mz-web-server ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-property) # mz-web-server ---
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) > process-classes # mz-web-server >>>
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven) # mz-web-server ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-property) # mz-web-server ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # mz-web-server ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) # mz-web-server ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) < process-classes # mz-web-server <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) # mz-web-server ---
[INFO] Running war on http://localhost:8080/
[INFO] Using existing Tomcat server configuration at E:\java\mz\mz-server\mz-web-server\target\tomcat
[INFO] setting SystemProperties:
[INFO] gwt.codeserver.port=9876
[INFO] create webapp with contextPath:
Jun 03, 2016 5:24:57 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jun 03, 2016 5:24:57 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Jun 03, 2016 5:24:57 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.47
...
What am I doing wrong here? I actually don't know if validate is a good choice here and I am not really bound to a certain phase. All I want is to make sure that the configuration files are getting copied according to package-mode.
But:
If I just run
mvn validate -Dpackage-mode=dev
then everything is working as expected - the files are getting copied.
You shouldn't use the maven-resources-plugin to copy webapp resources, this plugin is only for application resources. Furthermore, you should never generate or copy files under src, like what you're doing with <outputDirectory>src/main/webapp/WEB-INF/config</outputDirectory>. Generated files should always be placed under the target folder.
Instead, use the maven-war-plugin. You can configure it to filter a specific directory and output it in the WAR like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<webResources>
<resource>
<directory>src/main/assembly/${package-mode}/config</directory>
<filtering>true</filtering>
<targetPath>WEB-INF/config</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
This will filter the directory src/main/assembly/${package-mode}/config and place the files under it in the target folder WEB-INF/config in the WAR.
With this change, you will be able to run your webapp with mvn clean tomcat7:run-war (and not tomcat7:run since that wouldn't package the WAR).
Related
Are the pre and post phases always executed when I execute the associated phase? For example, if I do mvn clean, will this execute the mvn post-clean phase, too?
I was looking at https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference, in which it said:
The following lists all build phases of the default, clean and site
lifecycles, which are executed in the order given up to the point of
the one specified.
So strictly speaking, since post-clean comes after clean, it should not be executed if I just do mvn clean. But my gut feel is different - although, I didn't find a way to verify this, as the maven stdout doesn't print the phase it's executing.
Could anyone weigh in on the answer and how you verified?
You can bind a plugin (such as echo-maven-plugin) to the phases of the clean lifecycle to help verify if/when each phase is executed.
For example, given the following plugin definition:
<plugin>
<groupId>com.github.ekryd.echo-maven-plugin</groupId>
<artifactId>echo-maven-plugin</artifactId>
<version>1.2.0</version>
<executions>
<execution>
<id>pre-clean</id>
<phase>pre-clean</phase>
<goals>
<goal>echo</goal>
</goals>
<configuration>
<message>In 'pre-clean'</message>
</configuration>
</execution>
<execution>
<id>clean</id>
<phase>clean</phase>
<goals>
<goal>echo</goal>
</goals>
<configuration>
<message>In 'clean'</message>
</configuration>
</execution>
<execution>
<id>post-clean</id>
<phase>post-clean</phase>
<goals>
<goal>echo</goal>
</goals>
<configuration>
<message>In 'post-clean'</message>
</configuration>
</execution>
</executions>
</plugin>
Invoking mvn clean will result in the following output:
$ mvn clean
[INFO] Scanning for projects...
[INFO]
[INFO] --- echo-maven-plugin:1.2.0:echo (pre-clean) # sandbox ---
[INFO] In 'pre-clean'
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # sandbox ---
[INFO] Deleting target
[INFO]
[INFO] --- echo-maven-plugin:1.2.0:echo (clean) # sandbox ---
[INFO] In 'clean'
So, there's no invocation of the post-clean phase there.
Invoking mvn clean compile will result in the following output:
$ mvn clean compile
[INFO] Scanning for projects...
[INFO]
[INFO] --- echo-maven-plugin:1.2.0:echo (pre-clean) # sandbox ---
[INFO] In 'pre-clean'
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # sandbox ---
[INFO]
[INFO] --- echo-maven-plugin:1.2.0:echo (clean) # sandbox ---
[INFO] In 'clean'
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # sandbox ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) # sandbox ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 5 source files to ...
Again, there's no invocation of the post-clean phase there. This implies that the maven-clean-plugin (and perhaps nothing else) is not bound to post-clean.
Invoking mvn post-clean will result in the post-clean phase being invoked ...
$ mvn post-clean
[INFO] Scanning for projects...
[INFO]
[INFO] --- echo-maven-plugin:1.2.0:echo (pre-clean) # sandbox ---
[INFO] In 'pre-clean'
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # sandbox ---
[INFO] Deleting target
[INFO]
[INFO] --- echo-maven-plugin:1.2.0:echo (clean) # sandbox ---
[INFO] In 'clean'
[INFO]
[INFO] --- echo-maven-plugin:1.2.0:echo (post-clean) # sandbox ---
[INFO] In 'post-clean'
So, based on the above test I think the following statements are true:
post-clean is not invoked when you call clean
post-clean is only called when you explicitly invoke post-clean (note: invoking the pre- and post- phases directly is unusual)
I am making a maven project that will make use of Jaxb2-maven-plugin to generate java files out of xsd files. My Project structure is like:
project.basedir
--src/main/resources/schemas
----common
----request
----response
Below is the plugin config from pom.xml
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>xjc-PDF</id>
<phase>generate-sources</phase>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<extension>true</extension>
<clearOutputDir>false</clearOutputDir>
<outputDirectory>${project.build.directory}/generated-sources/jaxb</outputDirectory>
<explicitAnnotation>true</explicitAnnotation>
<!-- <schemaDirectory>${project.basedir}/src/main/resources/schemas</schemaDirectory> -->
<sources>
<source>${project.basedir}/src/main/resources/schemas/common</source>
<source>${project.basedir}/src/main/resources/schemas/response</source>
<source>${project.basedir}/src/main/resources/schemas/request</source>
</sources>
<bindingDirectory>${project.basedir}/src/main/resources/schemas</bindingDirectory>
<!-- <bindingDirectory>${project.basedir}/src/main/resources/bindings</bindingDirectory> -->
<bindingFiles>jaxb-bth.xjb</bindingFiles>
</configuration>
</execution>
</executions>
</plugin>
If I compile like this then I get below error (even though the source directories contains valid schema files):
C:\ESB_SOAP5_Space\pdf-util>mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building pdf-util 1.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # pdf-util ---
[INFO] Deleting C:\ESB_SOAP5_Space\pdf-util\target
[INFO]
[INFO] --- build-helper-maven-plugin:1.6:add-source (add-source) # pdf-util ---
[INFO] Source directory: C:\ESB_SOAP5_Space\pdf-util\target\generated-sources\jaxb added.
[INFO]
[INFO] --- jaxb2-maven-plugin:1.6:xjc (xjc-PDF) # pdf-util ---
[INFO] Generating source...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.205 s
[INFO] Finished at: 2018-03-19T06:27:02+11:00
[INFO] Final Memory: 8M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:1.6:xjc (xjc-PDF) on project pdf-util: No schemas have been found -> [Help 1]
However, if I comment sources and uncomment and modify like below, then I am able to generate java classes out of schemas under common.
<schemaDirectory>${project.basedir}/src/main/resources/schemas/common</schemaDirectory>
Can anyone tell me why is this behaving like this? Also what do I do if I have to parse all the schema files under one root folder ( which has multiple child folders)?
Thanks
Version 1.6 of the plugin does not support "sources" tag. You can use "sources tag on version 2.4 or newer.
If you have multiple directories containing xsds, use multiple executions in your configuration with each schemaDirectory pointing to one of your directories.
I'm new to jenkins and have a problem. I created a maven project (maven integration plugin 2.12.1) in jenkins (ver. 1.638). I got the source-code via git (maven web application).
Everything works fine, but at the end the .war which is moved/deployed via deploy plugin to the remote server has a wrong name.
I dont know why the .war file is renamed before it is deployed on the remoteserver.
It is called services.war instead of services_admin.war.
Screenshot jenkins:
https://i.stack.imgur.com/uc5wK.png
pom.xml:
<groupId>services_admin</groupId>[enter image description here][1]
<artifactId>services_admin</artifactId>
<name>services_admin</name>
<description>services_admin</description>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
<resource>
<directory>${basedir}/src/main/java</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<wtpversion>1.5</wtpversion>
<additionalProjectFacets>
<jst.java>6.0</jst.java>
<jst.web>2.5</jst.web>
</additionalProjectFacets>
<additionalBuildcommands>
<buildcommand>org.eclipse.wst.common.project.facet.core.builder</buildcommand>
<buildcommand>org.eclipse.wst.validation.validationbuilder</buildcommand>
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
</additionalBuildcommands>
<additionalProjectnatures>
<projectnature>org.eclipse.wst.common.project.facet.core.nature</projectnature>
<projectnature>org.eclipse.wst.common.modulecore.ModuleCoreNature</projectnature>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
</additionalProjectnatures>
</configuration>
</plugin>
</plugins>
<finalName>services_admin</finalName>
</build>
Build log:
[INFO] ------------------------------------------------------------------------
[INFO] Building services_admin 2
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # services_admin ---
[INFO] Deleting D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # services_admin ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 120 resources
[INFO] Copying 307 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) # services_admin ---
[INFO] Compiling 307 source files to D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target\classes
[WARNING] D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\src\main\java\de\...\services\java\util\Cryptographer.java:[34,40] BASE64Encoder is internal proprietary API and may be removed in a future release
[WARNING] D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\src\main\java\de\...\services\java\util\Cryptographer.java:[59,39] BASE64Decoder is internal proprietary API and may be removed in a future release
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # services_admin ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:testCompile (default-testCompile) # services_admin ---
[INFO] Compiling 48 source files to D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # services_admin ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) # services_admin ---
[INFO] Packaging webapp
[INFO] Assembling webapp [services_admin] in [D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target\services_admin]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\src\main\webapp]
[INFO] Webapp assembled in [2328 msecs]
[INFO] Building war: D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target\services_admin.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.360 s
[INFO] Finished at: 2017-01-31T16:00:01+01:00
[INFO] Final Memory: 46M/447M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\pom.xml to services_admin/services_admin/2/services_admin-2.pom
[JENKINS] Archiving D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target\services_admin.war to services_admin/services_admin/2/services_admin-2.war
channel stopped
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Deploying D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target\services_admin.war to container Tomcat 7.x Remote
Redeploying [D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target\services_admin.war]
Undeploying [D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target\services_admin.war]
Deploying [D:\Programme_x64\Jenkins\jobs\Mavenproject - services Admin (Test)\workspace\target\services_admin.war]
Finished: SUCCESS
remoteserver log:
Feb 01, 2017 9:50:09 AM org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager] log
INFORMATION: Manager: list: Listing contexts for virtual host 'localhost'
Feb 01, 2017 9:50:09 AM org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager] log
INFORMATION: Manager: deploy: Deploying web application '/services'
Feb 01, 2017 9:50:09 AM org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager] log
INFORMATION: Manager: Uploading WAR file to D:\Programme_x64\tomcat\...\webapps\services.war
Feb 01, 2017 9:50:15 AM org.apache.catalina.startup.HostConfig deployWAR
INFORMATION: Deploying web application archive D:\Programme_x64\tomcat\...\webapps\services.war
Feb 01, 2017 9:50:15 AM org.apache.tomcat.util.digester.Digester begin
WARNUNG: [SetContextPropertiesRule]{Context} Setting property 'antiJARLocking' to 'true' did not find a matching property.
Feb 01, 2017 9:50:24 AM org.apache.jasper.servlet.TldScanner scanJars
INFORMATION: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Feb 01, 2017 9:50:25 AM org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/services] log
INFORMATION: No Spring WebApplicationInitializer types detected on classpath
Feb 01, 2017 9:50:25 AM org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/services] log
INFORMATION: Set web app root system property: 'OsWebApp.root' = [D:\Programme_x64\tomcat\...\temp\6-services\]
Feb 01, 2017 9:50:25 AM org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/services] log
INFORMATION: Initializing Spring root WebApplicationContext
Feb 01, 2017 9:50:31 AM com.sun.faces.config.ConfigureListener contextInitialized
INFORMATION: Mojarra 2.1.13 ( 20120907-1514) für Kontext '/services' wird initialisiert.
Feb 01, 2017 9:50:32 AM com.sun.faces.spi.InjectionProviderFactory createInstance
INFORMATION: JSF1048: PostConstruct/PreDestroy-Annotationen vorhanden. Verwaltete Bean-Methoden, die mit diesen Annotationen markiert sind, lassen die entsprechenden Annotationen verarbeiten.
Feb 01, 2017 9:50:33 AM com.sun.faces.config.configprovider.BaseWebConfigResourceProvider getResources
WARNUNG: JSF1067: Ressource /WEB_INF/wickedcharts.taglib.xml, die von der Konfigurationsoption javax.faces.CONFIG_FILES angegeben wird, kann nicht gefunden werden. Die Ressource wird ignoriert.
Feb 01, 2017 9:50:33 AM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
INFORMATION: Running on PrimeFaces 5.3
Feb 01, 2017 9:50:33 AM org.apache.catalina.startup.HostConfig deployWAR
INFORMATION: Deployment of web application archive D:\Programme_x64\tomcat\...\webapps\services.war has finished in 17,323 ms
i dont use the "deploy plugin - deploy war/ear to a container" for this project. Instead of that im using now "Send files to a windows share - CIFS Publishers".
The problem with the "deploy plugin - deploy war/ear to a container" i could solve :(.
Anyway thx for ur help :).
Best regards
Could anyone help me with this,
My jasmine javascript unit tests run successfully when i build my app in eclipse:
[INFO] --- maven-install-plugin:2.3.1:install (default-install) # sig ---
[INFO] Installing C:\Users\C5168279\git\smsigcom.sap.solman.graphical.component.sig\SMSIG\target\sig.war to C:\Users\C5168279\.m2\repository\com\sap\solman\graphical\component\sig\1.0.0\sig-1.0.0.war
[INFO] Installing C:\Users\C5168279\git\smsigcom.sap.solman.graphical.component.sig\SMSIG\pom.xml to C:\Users\C5168279\.m2\repository\com\sap\solman\graphical\component\sig\1.0.0\sig-1.0.0.pom
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:exec (default-cli) # sig ---
2014-02-20 17:35:35 Device API logging initialized - DEVICE
2014-02-20 17:35:35 registerResourcePath ('', 'https://sapui5.hana.ondemand.com/resources/') - sap.ui.ModuleSystem
2014-02-20 17:35:35 URL prefixes set to: - sap.ui.ModuleSystem
2014-02-20 17:35:35 (default) : https://sapui5.hana.ondemand.com/resources/ - sap.ui.ModuleSystem
XMLHttpRequest cannot load https://sapui5.hana.ondemand.com/resources/sap/ui/controller/library-preload.json. Origin file:// is not allowed by Access-Control-Allow-Origin.
2014-02-20 17:35:37 failed to preload 'sap.ui.controller.library-preload': Error: NETWORK_ERR: XMLHttpRequest Exception 101 - sap.ui.ModuleSystem
XMLHttpRequest cannot load https://sapui5.hana.ondemand.com/resources/sap/ui/controller/library.js. Origin file:// is not allowed by Access-Control-Allow-Origin.
Error: failed to load 'sap/ui/controller/library.js' from https://sapui5.hana.ondemand.com/resources/sap/ui/controller/library.js: 0 - Error: NETWORK_ERR: XMLHttpRequest Exception 101
file:///C:/Users/C5168279/git/smsigcom.sap.solman.graphical.component.sig/SMSIG/src/test/js_unit/AppCoreController.Test.js:1
Runner Started.
MainController : should check if all parameters are empty , ags_sig_app.Views.Main : Graph.checkParameters() ...
Failed.
MainController : should check that the GraphID exist for Display Mode, ags_sig_app.Views.Main : Graph.checkParameters() ...
Failed.
MainController : should check that the Context Parameters exist for SMUD Graph Providers, ags_sig_app.Views.Main : Graph.checkParameters() ...
Failed.
MainController : should check that the GraphMode exist, ags_sig_app.Views.Main : Graph.checkParameters() ...
Failed.
MainController : should check that Display scenario is ok, ags_sig_app.Views.Main : Graph.checkParameters() ...
Failed.
BUT, when i deploy my application in Jenkins the test case are not detected by Jenkins
the exec-maven-plugin does not run on jenkins.
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) # SMGC ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # SMGC ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory d:\.jenkins\jobs\com.sap.solman.graphical.component.sig.git\workspace\gitRepo\SMSIG\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) # SMGC ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # SMGC ---
[INFO] No tests to run.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.676s
[INFO] Finished at: Thu Feb 20 17:23:29 CET 2014
[INFO] Final Memory: 13M/491M
[INFO] ------------------------------------------------------------------------
Finished: SUCCESS
This is the plugin my pom.xml:
<plugins>
<!-- Run jasmine unit tests with phantomjs ************************* -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>PhantomJS Unit Testing</id>
<phase>test</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>${basedir}/src/test/phantomjs_framework/phantomjs.exe</executable>
<arguments>
<argument>run_jasmine.js</argument>
<argument>test_runner.html</argument>
<!-- <argument>${project.build.directory}/surefire-reports</argument> -->
</arguments>
<workingDirectory>${basedir}/src/test/phantomjs_framework</workingDirectory>
</configuration>
</plugin>
Any ideas?
Kais.
I'm trying to create the Findbugs HTML report for the site reports. I finally got Findbugs to actually run (before it would skip) because I had to include the goal findbugs in the <build> phase under the find bugs report. However, the findbugs.html report is not being generated even though I have findbugs defined in my <reporting> section.
Here's my configuration for Findbugs:
<build>
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<xmlOutput>true</xmlOutput>
</configuration>
<executions>
<execution>
<goals>
<goal>findbugs</goal>
</goals>
</execution>
</executions>
</plugin>
....
<plugins>
</build>
....
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<xmlOutput>true</xmlOutput>
<failOnError>false</failOnError>
<xmlOutput>true</xmlOutput>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
<reporting>
My execution looks like this:
$ mvn clean site
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building project 2.0.4
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # crypto ---
[INFO] Deleting target
[INFO]
[INFO] --- maven-site-plugin:3.3:site (default-site) # crypto ---
[INFO] configuring report plugin org.apache.maven.plugins:maven-project-info-reports-plugin:2.7
[INFO] configuring report plugin org.codehaus.mojo:findbugs-maven-plugin:2.5.2
[INFO] configuring report plugin org.apache.maven.plugins:maven-pmd-plugin:3.0.1
[INFO] configuring report plugin org.apache.maven.plugins:maven-javadoc-plugin:2.9.1
[INFO]
[INFO] >>> maven-javadoc-plugin:2.9.1:aggregate (report:aggregate) # crypto >>>
[INFO]
[INFO] --- axis2-wsdl2code-maven-plugin:1.5.6:wsdl2code (default) # crypto ---
Retrieving document at 'src/main/wsdl/Tokenizer.wsdl'.
[INFO]
[INFO] --- build-helper-maven-plugin:1.8:add-source (add-source) # crypto ---
[INFO] Source directory: target/generated-sources added.
[INFO]
[INFO] <<< maven-javadoc-plugin:2.9.1:aggregate (report:aggregate) # crypto <<<
[INFO]
[INFO] >>> maven-javadoc-plugin:2.9.1:test-aggregate (report:test-aggregate) # crypto >>>
[INFO]
[INFO] --- axis2-wsdl2code-maven-plugin:1.5.6:wsdl2code (default) # crypto ---
Retrieving document at 'src/main/wsdl/SafeNetTokenizer.wsdl'.
[INFO]
[INFO] --- build-helper-maven-plugin:1.8:add-source (add-source) # crypto ---
[INFO] Source directory: /Users/david/workspace/KeyManagment-trunk/target/generated-sources added.
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # crypto ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/david/workspace/KeyManagment-trunk/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) # crypto ---
[INFO] Compiling 13 source files to /Users/david/workspace/KeyManagment-trunk/target/classes
[INFO]
[INFO] --- findbugs-maven-plugin:2.5.2:findbugs (default) # crypto ---
[INFO] Fork Value is true
[java] The following classes needed for analysis were missing:
[java] com.ingrian.internal.ilc.IngrianLogger
[java] com.ingrian.security.nae.NAESession
[java] com.ingrian.internal.config.Config
[java] com.ingrian.security.nae.NAEKey
[java] com.ingrian.security.nae.HmacSHA256
[java] com.ingrian.internal.xml.XMLException
[java] com.ingrian.security.nae.NAEAESCipher
[java] com.ingrian.security.nae.IngrianProvider
[java] Warnings generated: 310
[java] Missing classes: 8
[INFO] Done FindBugs Analysis....
[INFO]
[INFO] --- maven-bundle-plugin:2.3.7:manifest (bundle-manifest) # crypto ---
[INFO]
[INFO] <<< maven-javadoc-plugin:2.9.1:test-aggregate (report:test-aggregate) # crypto <<<
[INFO]
[INFO] >>> maven-javadoc-plugin:2.9.1:javadoc (report:javadoc) # crypto >>>
[INFO]
[INFO] --- axis2-wsdl2code-maven-plugin:1.5.6:wsdl2code (default) # crypto ---
Retrieving document at 'src/main/wsdl/SafeNetTokenizer.wsdl'.
[INFO]
[INFO] --- build-helper-maven-plugin:1.8:add-source (add-source) # crypto ---
[INFO] Source directory: /Users/david/workspace/KeyManagment-trunk/target/generated-sources added.
[INFO]
[INFO] <<< maven-javadoc-plugin:2.9.1:javadoc (report:javadoc) # crypto <<<
[INFO]
[INFO] >>> maven-javadoc-plugin:2.9.1:test-javadoc (report:test-javadoc) # crypto >>>
[INFO]
[INFO] --- axis2-wsdl2code-maven-plugin:1.5.6:wsdl2code (default) # crypto ---
Retrieving document at 'src/main/wsdl/SafeNetTokenizer.wsdl'.
[INFO]
[INFO] --- build-helper-maven-plugin:1.8:add-source (add-source) # crypto ---
[INFO] Source directory: /Users/david/workspace/KeyManagment-trunk/target/generated-sources added.
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # crypto ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/david/workspace/KeyManagment-trunk/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) # crypto ---
[INFO] Compiling 2 source files to /Users/david/workspace/KeyManagment-trunk/target/classes
[INFO]
[INFO] --- findbugs-maven-plugin:2.5.2:findbugs (default) # crypto ---
[INFO] Fork Value is true
[java] The following classes needed for analysis were missing:
[java] com.ingrian.internal.ilc.IngrianLogger
[java] com.ingrian.security.nae.NAESession
[java] com.ingrian.internal.config.Config
[java] com.ingrian.security.nae.NAEKey
[java] com.ingrian.security.nae.HmacSHA256
[java] com.ingrian.internal.xml.XMLException
[java] com.ingrian.security.nae.NAEAESCipher
[java] com.ingrian.security.nae.IngrianProvider
[java] Warnings generated: 310
[java] Missing classes: 8
[INFO] Done FindBugs Analysis....
[INFO]
[INFO] --- maven-bundle-plugin:2.3.7:manifest (bundle-manifest) # crypto ---
[INFO]
[INFO] <<< maven-javadoc-plugin:2.9.1:test-javadoc (report:test-javadoc) # crypto <<<
[WARNING] No project URL defined - decoration links will not be relativized!
[INFO] Rendering site with org.apache.maven.skins:maven-default-skin:jar:1.0 skin.
[INFO] Skipped "JavaDocs" report, file "apidocs/index.html" already exists for the English version.
[INFO] Skipped "Test JavaDocs" report, file "testapidocs/index.html" already exists for the English version.
[INFO] Generating "About" report --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Plugin Management" report --- maven-project-info-reports-plugin:2.7
...
[INFO] Generating "Project Team" report --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Project Summary" report --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Dependencies" report --- maven-project-info-reports-plugin:2.7
[INFO] Generating "CPD Report" report --- maven-pmd-plugin:3.0.1
[WARNING] Unable to locate Source XRef to link to - DISABLED
[INFO] Generating "PMD Report" report --- maven-pmd-plugin:3.0.1
[WARNING] Unable to locate Source XRef to link to - DISABLED
[INFO] Generating "JavaDocs" report --- maven-javadoc-plugin:2.9.1
[INFO]
Loading source files for package com.ihotelier.crypto...
Loading source files for package com.safenet.tokenization.wsclient...
Constructing Javadoc information...
Standard Doclet version 1.7.0_13
Building tree for all the packages and classes...
Generating ...
4 warnings
[WARNING] Javadoc Warnings
[WARNING] ...
[INFO] Fixed Javadoc frame injection vulnerability (CVE-2013-1571) in 1 files.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3:30.831s
[INFO] Finished at: Tue Nov 05 14:02:04 EST 2013
[INFO] Final Memory: 40M/115M
[INFO] ------------------------------------------------------------------------
I see findbugs being configured in the beginning of my execution under the maven-site-plugin. I see Findbugs executing (twice!) after maven-compiler-plugin runs. (I may change the goal to process-classes to prevent this double execution. I see 8 errors, but we don't really use those classes. (I need to figure out how to skip over these classes).
Near the end of the build, I see the PMD and CPD Reports being generated (Generating "CPD Report" report), but not Findbugs.
When I look at the build results, I see target/findbugs.xml and target/findbugsXML.xml, but nothing under target/site.
Sorry for the excessive output. I want to make sure I wasn't skipping anything important.
Shows you what I know about Maven. Two things I discovered:
Running site does not execute package (although compile does run -- probably because it's needed for some of the reports).
Findbugs cannot produce a site report unless the package is done first.
I moved findbugs plugin to run in the package phase, so it doesn't run twice, and everything now seems fine.
I think it's similar to the surefire reports issues, so try adding the site plugin to the <pluginManagement> section:
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
</plugin>
</plugins>
</pluginManagement>