maven profile should be activated but is not - java

I have been using maven for years now but I bumped into an issue.
As always I create a repo to illustrate my issue:
git clone https://github.com/clembo590/issues.git --branch mavenProfiles
I just created a multi module maven where I expect the QA profile to be active but it is not.
Here is how the parent pom look like:
<profiles>
<!-- build mdr-commons ONLY IF PRESENT -->
<profile>
<id>mdr-commons</id>
<activation>
<file>
<exists>mdr-commons/pom.xml</exists>
</file>
</activation>
<modules>
<module>mdr-commons</module>
</modules>
</profile>
<profile>
<id>QA</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<!-- this is to check that the coded is formatted : you can use 'apply' instead of 'check' to actually format the code -->
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
if you run mvn clean install you will get
those logs:
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] mdr-parent [pom]
[INFO] mdr-commons [pom]
[INFO]
[INFO] -----------------------< com.example:mdr-parent >-----------------------
[INFO] Building mdr-parent 1.0.0 [1/2]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # mdr-parent ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # mdr-parent ---
[INFO] Installing ...
[INFO]
[INFO] ----------------------< com.example:mdr-commons >-----------------------
[INFO] Building mdr-commons 1.0.0 [2/2]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # mdr-commons ---
[INFO]
[INFO] --- spotless-maven-plugin:2.11.1:check (default) # mdr-commons ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # mdr-commons ---
[INFO] Installing ...
[INFO] ------------------------------------------------------------------------
spotless-maven-plugin is not executed when building mdr-parent which means that QA profile is not active when build mdr-parent. (it is active when building mdr-commons)
question 1:
why is QA profile not active when building mdr-parent?
question 2:
just delete completely the folder called mdr-commons and re run mvn clean install
--> why is QA profile active this time ? (you will see in the logs that the spotless-maven-plugin is executed)
thanks in advance maven experts

The answer can be found in Details on profile activation of the Maven Guide.
TLDR; Profiles which are activeByDefault are deactivated whenever another profile was activated by any other method.
The mdr-commons profile is activated if file mdr-commons/pom.xml exists. In that case, the QA profile is deactivated. If this file does not exist, the QA profile is "active by default".

That is described in documentation:
This profile will automatically be active for all builds unless
another profile in the same POM is activated using one of the
previously described methods. All profiles that are active by default
are automatically deactivated when a profile in the POM is activated
on the command line or through its activation config.

Related

Maven Pom.xml not running

I try to run my test as -mvn test, it is showing as build is success but , No Source to Compile.Down I have attached my both pom and Result file.
Output :
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Wepaythemax 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # Wepaythemax ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\rck\git\repository3\Wepaythemax\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) # Wepaythemax ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # Wepaythemax ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) # Wepaythemax ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # Wepaythemax ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.051 s
[INFO] Finished at: 2018-12-20T18:37:53+05:30
[INFO] Final Memory: 10M/114M
Pom.xml File
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Wepaythemax</groupId>
<artifactId>Wepaythemax</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.141.5</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>selenium-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Help Me out, Where I have done Mistake, I can't find out. I'm Trying to Figure it out.Also I have attached a Screenshot Where the My testng.xml file is placed
no sources to compile, means no java file in src/main/java or src/test/java.
sources are in src/main/java, sources is different from resources, which means .xml,etc.

frontend-maven-plugin executed twice

frontend-maven-plugin is getting executed twice when i issue the followign command -
mvn clean install package -DenvType=local2
My pom.xml -
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.awpl</groupId>
<artifactId>pva-nb-uw-ui</artifactId>
<packaging>war</packaging>
<version>0.2.0</version>
<profiles>
<profile>
<id>local</id>
<activation>
<property>
<name>envType</name>
<value>local</value>
</property>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<envType>local</envType>
</properties>
</profile>
<profile>
<id>local2</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<envType>local2</envType>
</properties>
</profile>
<profile>
<id>dev</id>
<activation>
<property>
<name>envType</name>
<value>dev</value>
</property>
</activation>
<properties>
<envType>dev</envType>
</properties>
</profile>
<profile>
<id>sit</id>
<activation>
<property>
<name>envType</name>
<value>sit</value>
</property>
</activation>
<properties>
<envType>sit</envType>
</properties>
</profile>
<profile>
<id>uat</id>
<activation>
<property>
<name>envType</name>
<value>uat</value>
</property>
</activation>
<properties>
<envType>uat</envType>
</properties>
</profile>
</profiles>
<build>
<finalName>pva-ui-webapp</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.4</version>
<!-- <configuration> <installDirectory>target</installDirectory>
</configuration> -->
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<nodeVersion>v6.10.0</nodeVersion>
<npmVersion>3.10.10</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>bower install</id>
<goals>
<goal>bower</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>gulp build</id>
<goals>
<goal>gulp</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>optimize --env ${envType}</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
The output of the command --
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building artifactname 0.2.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # artifactname ---
[INFO] Deleting D:\Softwares\workspace_eclipse\artifactname\target
[INFO]
[INFO] --- frontend-maven-plugin:1.4:install-node-and-npm (install node and npm) # artifactname ---
[INFO] Node v6.10.0 is already installed.
[INFO] NPM 3.10.10 is already installed.
[INFO]
[INFO] --- frontend-maven-plugin:1.4:npm (npm install) # artifactname ---
[INFO] Running 'npm install' in D:\Softwares\workspace_eclipse\artifactname
[WARNING] npm WARN artifactname#0.2.0 No repository field.
[INFO]
[INFO] --- frontend-maven-plugin:1.4:bower (bower install) # artifactname ---
[INFO] Running 'bower install' in D:\Softwares\workspace_eclipse\artifactname
[INFO]
[INFO] --- frontend-maven-plugin:1.4:gulp (gulp build) # artifactname ---
[INFO] Running 'gulp optimize --env local2' in D:\Softwares\workspace_eclipse\artifactname
[INFO] [10:50:06] Using gulpfile D:\Softwares\workspace_eclipse\artifactname\gulpfile.js
[INFO] [10:50:06] Starting 'lintjs'...
[INFO] [10:50:06] Analyzing JS files
[INFO] [10:50:06] Starting 'linthtml'...
[INFO] [10:50:06] Analyzing HTML files
[INFO] [10:50:06] Starting 'lintcss'...
[INFO] [10:50:06] Analyzing CSS files
[INFO] [10:50:06] Starting 'lintjson'...
[INFO] [10:50:06] Analyzing JSON files
[INFO] [10:50:06] Starting 'clean'...
[INFO] [10:50:06] cleaning ./src/main/webapp/js/,./src/main/webapp/fonts/,./src/main/webapp/resources/,./src/main/webapp/styles/,./src/main/webapp/index.html,./src/main/webapp/rev-manifest.json,./.tmp/
[ERROR] The rule `angular/service-name` will be split up to different rules in the next version. Please read the docs for more information
[INFO] [10:50:07] Finished 'clean' after 1.13 s
[INFO] [10:50:07] Starting 'jsoncopy'...
[INFO] [10:50:07] copying and minifying json resources
[INFO] [10:50:10] Finished 'lintcss' after 3.37 s
[INFO] [10:51:12] Finished 'lintjson' after 1.1 min
[INFO] [10:51:13] Finished 'jsoncopy' after 1.08 min
[INFO] [10:51:13] Starting 'htmlcopy'...
[INFO] [10:51:13] copying html files for making it ready for templatecache
[INFO] [10:51:14] Finished 'linthtml' after 1.12 min
[INFO] [10:51:16] Finished 'lintjs' after 1.17 min
[INFO] [10:51:16] Starting 'wireindex'...
[INFO] [10:51:16] Linking all js/css files into index.html
[INFO] [10:51:17] gulp-inject 100 files into index.html.
[INFO] [10:51:17] gulp-inject 3 files into index.html.
[INFO] [10:51:17] Finished 'wireindex' after 705 ms
[INFO] [10:51:17] Finished 'htmlcopy' after 3.21 s
[INFO] [10:51:17] Starting 'fontscopy'...
[INFO] [10:51:17] copying bootstrap and other fonts
[INFO] [10:51:17] Finished 'fontscopy' after 224 ms
[INFO] [10:51:17] Starting 'templatecache'...
[INFO] [10:51:17] creating AngularJS $templateCache
[INFO] [10:51:18] Finished 'templatecache' after 824 ms
[INFO] [10:51:18] Starting 'optimize'...
[INFO] [10:51:18] optimizing the js/html/css files
[INFO] [10:51:19] gulp-inject 1 files into index.html.
[INFO] [10:51:31] Finished 'optimize' after 13 s
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # artifactname ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Softwares\workspace_eclipse\artifactname\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) # artifactname ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # artifactname ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Softwares\workspace_eclipse\artifactname\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) # artifactname ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # artifactname ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) # artifactname ---
[INFO] Packaging webapp
[INFO] Assembling webapp [artifactname] in [D:\Softwares\workspace_eclipse\artifactname\target\pva-ui-webapp]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\Softwares\workspace_eclipse\artifactname\src\main\webapp]
[INFO] Webapp assembled in [600 msecs]
[INFO] Building war: D:\Softwares\workspace_eclipse\artifactname\target\pva-ui-webapp.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # artifactname ---
[INFO] Installing D:\Softwares\workspace_eclipse\artifactname\target\pva-ui-webapp.war to C:\Users\Admin\.m2\repository\com\mycompany\artifactname\0.2.0\artifactname-0.2.0.war
[INFO] Installing D:\Softwares\workspace_eclipse\artifactname\pom.xml to C:\Users\Admin\.m2\repository\com\mycompany\artifactname\0.2.0\artifactname-0.2.0.pom
[INFO]
[INFO] --- frontend-maven-plugin:1.4:install-node-and-npm (install node and npm) # artifactname ---
[INFO] Node v6.10.0 is already installed.
[INFO] NPM 3.10.10 is already installed.
[INFO]
[INFO] --- frontend-maven-plugin:1.4:npm (npm install) # artifactname ---
[INFO] Running 'npm install' in D:\Softwares\workspace_eclipse\artifactname
[WARNING] npm WARN artifactname#0.2.0 No repository field.
[INFO]
[INFO] --- frontend-maven-plugin:1.4:bower (bower install) # artifactname ---
[INFO] Running 'bower install' in D:\Softwares\workspace_eclipse\artifactname
[INFO]
[INFO] --- frontend-maven-plugin:1.4:gulp (gulp build) # artifactname ---
[INFO] Running 'gulp optimize --env local2' in D:\Softwares\workspace_eclipse\artifactname
[INFO] [10:51:48] Using gulpfile D:\Softwares\workspace_eclipse\artifactname\gulpfile.js
[INFO] [10:51:48] Starting 'lintjs'...
[INFO] [10:51:48] Analyzing JS files
[INFO] [10:51:49] Starting 'linthtml'...
[INFO] [10:51:49] Analyzing HTML files
[INFO] [10:51:49] Starting 'lintcss'...
[INFO] [10:51:49] Analyzing CSS files
[INFO] [10:51:49] Starting 'lintjson'...
[INFO] [10:51:49] Analyzing JSON files
[INFO] [10:51:49] Starting 'clean'...
[INFO] [10:51:49] cleaning ./src/main/webapp/js/,./src/main/webapp/fonts/,./src/main/webapp/resources/,./src/main/webapp/styles/,./src/main/webapp/index.html,./src/main/webapp/rev-manifest.json,./.tmp/
[ERROR] The rule `angular/service-name` will be split up to different rules in the next version. Please read the docs for more information
[INFO] [10:51:50] Finished 'clean' after 1.05 s
[INFO] [10:51:50] Starting 'jsoncopy'...
[INFO] [10:51:50] copying and minifying json resources
[INFO] [10:51:52] Finished 'lintcss' after 3.29 s
[INFO] [10:52:56] Finished 'lintjson' after 1.12 min
[INFO] [10:52:58] Finished 'jsoncopy' after 1.12 min
[INFO] [10:52:58] Starting 'htmlcopy'...
[INFO] [10:52:58] copying html files for making it ready for templatecache
[INFO] [10:52:58] Finished 'linthtml' after 1.13 min
[INFO] [10:53:00] Finished 'lintjs' after 1.18 min
[INFO] [10:53:00] Starting 'wireindex'...
[INFO] [10:53:00] Linking all js/css files into index.html
[INFO] [10:53:01] gulp-inject 100 files into index.html.
[INFO] [10:53:01] gulp-inject 3 files into index.html.
[INFO] [10:53:01] Finished 'wireindex' after 568 ms
[INFO] [10:53:01] Finished 'htmlcopy' after 3.04 s
[INFO] [10:53:01] Starting 'fontscopy'...
[INFO] [10:53:01] copying bootstrap and other fonts
[INFO] [10:53:01] Finished 'fontscopy' after 182 ms
[INFO] [10:53:01] Starting 'templatecache'...
[INFO] [10:53:01] creating AngularJS $templateCache
[INFO] [10:53:02] Finished 'templatecache' after 805 ms
[INFO] [10:53:02] Starting 'optimize'...
[INFO] [10:53:02] optimizing the js/html/css files
[INFO] [10:53:02] gulp-inject 1 files into index.html.
[INFO] [10:53:15] Finished 'optimize' after 13 s
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # artifactname ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Softwares\workspace_eclipse\artifactname\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) # artifactname ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # artifactname ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Softwares\workspace_eclipse\artifactname\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) # artifactname ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # artifactname ---
[INFO] No tests to run.
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) # artifactname ---
[INFO] Packaging webapp
[INFO] Assembling webapp [artifactname] in [D:\Softwares\workspace_eclipse\artifactname\target\pva-ui-webapp]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\Softwares\workspace_eclipse\artifactname\src\main\webapp]
[INFO] Webapp assembled in [312 msecs]
[INFO] Building war: D:\Softwares\workspace_eclipse\artifactname\target\pva-ui-webapp.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:27 min
[INFO] Finished at: 2017-07-19T10:53:15+05:30
[INFO] Final Memory: 12M/122M
[INFO] ------------------------------------------------------------------------
Notice that the frontend-maven-plugin is executed twice. This almost doubles up the build time.
How do I make it run only once?
You are getting multiple executions because you have specified multiple default lifecycle phases on the command line:
mvn clean install package -DenvType=local2
This will:
run the clean lifecycle;
run the default lifecycle up to and including install (which includes package);
run the default lifecycle again up to and including package.
Please see Introduction to the Build Lifecycle for more information.

Apache Maven: cannot find symbol and invalid target release error (NetBeans support for Mule Plugin)

I am trying to run following command on following project:
mvn clean package nbm:cluster nbm:run-ide
Project URL: https://github.com/mulesoft-labs/mule-netbeans (Netbeans Support for Mule)
I tried it on Apanche Maven 3.0.4 and 3.0.5 but unable to run it.
I tried it with Java 6, Java 7 and Java 8.
With Java 7 and Java 8 i am getting following issues:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Mule Netbeans XML
[INFO] Mule Support Plugin
[INFO] Mule Tools for NetBeans
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Mule Netbeans XML 0.5
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) # mule-netbeans-xml ---
[INFO] Deleting D:\mule-netbeans-master\mule-netbeans-xml\target
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # mule-netbeans-xml ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\mule-netbeans-master\mule-netbeans-xml\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) # mule-netbeans-xml ---
[INFO] Compiling 2 source files to D:\mule-netbeans-master\mule-netbeans-xml\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] D:\mule-netbeans-master\mule-netbeans-xml\src\main\java\org\mule\tooling\netbeans\xml\UserCatalogProcessor.java:[38,37] error: cannot find symbol
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Skipping Mule Tools for NetBeans
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Mule Netbeans XML ................................. FAILURE [1.471s]
[INFO] Mule Support Plugin ............................... SKIPPED
[INFO] Mule Tools for NetBeans ........................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.154s
[INFO] Finished at: Thu May 04 08:53:45 IST 2017
[INFO] Final Memory: 15M/220M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project mule-netbeans-xml: Compilation failure
[ERROR] D:\mule-netbeans-master\mule-netbeans-xml\src\main\java\org\mule\tooling\netbeans\xml\UserCatalogProcessor.java:[38,37] error: cannot find symbol
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
With Java 6, i am getting following:
Failure executing javac, but could not parse the error:
javac: invalid target release: 1.7
Usage: javac <options> <source files>
use -help for a list of possible options
POm.xml:
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.mule.tooling.netbeans</groupId>
<artifactId>mule-netbeans</artifactId>
<name>Mule Tools for NetBeans</name>
<description>NetBeans Support for Mule</description>
<version>1.1</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<netbeans-version>RELEASE82</netbeans-version>
</properties>
<licenses>
<license>
<name>Apache License 2.0</name>
<url>http://opensource.org/licenses/Apache-2.0</url>
</license>
</licenses>
<build>
<pluginManagement>
<plugins>
<plugin>
<!-- NetBeans 6.9+ requires JDK 6, starting NetBeans 7.4 source 1.7 is required -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<modules>
<!--<module>mule-netbeans-runtime</module>-->
<!--<module>mule-netbeans-api</module>-->
<!--<module>mule-netbeans-config</module>-->
<module>mule-netbeans-xml</module>
<module>mule-netbeans-plugin</module>
</modules>
<repositories>
<repository>
<id>netbeans</id>
<name>Repository hosting NetBeans modules</name>
<url>http://bits.netbeans.org/nexus/content/groups/netbeans</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>
Could anyone assist where i am doing wrong?
try to change to maven2 and you have to add this additional info in the pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerVersion>1.5</compilerVersion>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
Done following Changes to execute it perfectly.
Java 8, Apache Maven 3.0.5
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
Output:
Scanning for projects...
------------------------------------------------------------------------
Reactor Build Order:
Mule Netbeans XML
Mule Support Plugin
Mule Tools for NetBeans
------------------------------------------------------------------------
Building Mule Netbeans XML 0.5
------------------------------------------------------------------------
--- maven-clean-plugin:2.4.1:clean (default-clean) # mule-netbeans-xml ---
Deleting D:\mule-netbeans-master\mule-netbeans-xml\target
--- maven-resources-plugin:2.5:resources (default-resources) # mule-netbeans-xml ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory D:\mule-netbeans-master\mule-netbeans-xml\src\main\resources
--- maven-compiler-plugin:2.5.1:compile (default-compile) # mule-netbeans-xml ---
Compiling 2 source files to D:\mule-netbeans-master\mule-netbeans-xml\target\classes
--- maven-resources-plugin:2.5:testResources (default-testResources) # mule-netbeans-xml ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory D:\mule-netbeans-master\mule-netbeans-xml\src\test\resources
--- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) # mule-netbeans-xml ---
No sources to compile
--- maven-surefire-plugin:2.15:test (default-test) # mule-netbeans-xml ---
Tests are skipped.
--- maven-jar-plugin:2.4:jar (default-jar) # mule-netbeans-xml ---
Building jar: D:\mule-netbeans-master\mule-netbeans-xml\target\mule-netbeans-xml-0.5.jar
--- maven-install-plugin:2.3.1:install (default-install) # mule-netbeans-xml ---
Installing D:\mule-netbeans-master\mule-netbeans-xml\target\mule-netbeans-xml-0.5.jar to C:\Users\harpreetsi\.m2\repository\org\mule\tooling\netbeans\mule-netbeans-xml\0.5\mule-netbeans-xml-0.5.jar
Installing D:\mule-netbeans-master\mule-netbeans-xml\pom.xml to C:\Users\harpreetsi\.m2\repository\org\mule\tooling\netbeans\mule-netbeans-xml\0.5\mule-netbeans-xml-0.5.pom
------------------------------------------------------------------------
Building Mule Support Plugin 0.8-SNAPSHOT
------------------------------------------------------------------------
--- maven-clean-plugin:2.4.1:clean (default-clean) # mule-netbeans-plugin ---
Deleting D:\mule-netbeans-master\mule-netbeans-plugin\target
--- maven-resources-plugin:2.6:resources (default-resources) # mule-netbeans-plugin ---
Using 'UTF-8' encoding to copy filtered resources.
Copying 39 resources
--- maven-compiler-plugin:2.5.1:compile (default-compile) # mule-netbeans-plugin ---
Compiling 63 source files to D:\mule-netbeans-master\mule-netbeans-plugin\target\classes
--- nbm-maven-plugin:4.0.1:manifest (default-manifest) # mule-netbeans-plugin ---
NBM Plugin generates manifest
Adding on module's Class-Path:
org.mule.tooling.netbeans:mule-netbeans-xml:jar:0.5
org.jdesktop:beansbinding:jar:1.2.1
--- maven-resources-plugin:2.6:testResources (default-testResources) # mule-netbeans-plugin ---
Using 'UTF-8' encoding to copy filtered resources.
Copying 12 resources
--- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) # mule-netbeans-plugin ---
Compiling 2 source files to D:\mule-netbeans-master\mule-netbeans-plugin\target\test-classes
--- maven-surefire-plugin:2.15:test (default-test) # mule-netbeans-plugin ---
Tests are skipped.
--- maven-jar-plugin:2.4:jar (default-jar) # mule-netbeans-plugin ---
Adding existing MANIFEST to archive. Found under: D:\mule-netbeans-master\mule-netbeans-plugin\target\classes\META-INF\MANIFEST.MF
Building jar: D:\mule-netbeans-master\mule-netbeans-plugin\target\mule-netbeans-plugin-0.8-SNAPSHOT.jar
--- nbm-maven-plugin:4.0.1:branding (default-branding) # mule-netbeans-plugin ---
No branding to process.
--- nbm-maven-plugin:4.0.1:nbm (default-nbm) # mule-netbeans-plugin ---
Copying module JAR to D:\mule-netbeans-master\mule-netbeans-plugin\target\nbm\netbeans\mule\modules with manifest updates
Generating Auto Update information for org.mule.tooling.netbeans
No updater.jar specified, cannot validate Info.xml against DTD
Building jar: D:\mule-netbeans-master\mule-netbeans-plugin\target\nbm\mule-netbeans-plugin-0.8-SNAPSHOT.nbm
--- maven-install-plugin:2.5:install (default-install) # mule-netbeans-plugin ---
Installing D:\mule-netbeans-master\mule-netbeans-plugin\target\mule-netbeans-plugin-0.8-SNAPSHOT.jar to C:\Users\harpreetsi\.m2\repository\org\mule\tooling\netbeans\mule-netbeans-plugin\0.8-SNAPSHOT\mule-netbeans-plugin-0.8-SNAPSHOT.jar
Installing D:\mule-netbeans-master\mule-netbeans-plugin\pom.xml to C:\Users\harpreetsi\.m2\repository\org\mule\tooling\netbeans\mule-netbeans-plugin\0.8-SNAPSHOT\mule-netbeans-plugin-0.8-SNAPSHOT.pom
Installing D:\mule-netbeans-master\mule-netbeans-plugin\target\mule-netbeans-plugin-0.8-SNAPSHOT.nbm to C:\Users\harpreetsi\.m2\repository\org\mule\tooling\netbeans\mule-netbeans-plugin\0.8-SNAPSHOT\mule-netbeans-plugin-0.8-SNAPSHOT.nbm
------------------------------------------------------------------------
Building Mule Tools for NetBeans 1.1
------------------------------------------------------------------------
--- maven-clean-plugin:2.4.1:clean (default-clean) # mule-netbeans ---
--- maven-install-plugin:2.3.1:install (default-install) # mule-netbeans ---
Installing D:\mule-netbeans-master\pom.xml to C:\Users\harpreetsi\.m2\repository\org\mule\tooling\netbeans\mule-netbeans\1.1\mule-netbeans-1.1.pom
------------------------------------------------------------------------
Reactor Summary:
Mule Netbeans XML ................................. SUCCESS [5.716s]
Mule Support Plugin ............................... SUCCESS [23.561s]
Mule Tools for NetBeans ........................... SUCCESS [0.069s]
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 33.336s
Finished at: Thu May 04 09:30:43 IST 2017
Final Memory: 30M/394M
------------------------------------------------------------------------
You need to set JAVA_HOME to your jdk7 home directory, for example on Microsoft Windows:
"C:\Program Files\Java\jdk1.7.0_40"
or on OS X:
/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home

Maven not running Test [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I created a new maven project in Eclipse that runs simple test by using both HtmlUnitDriver and FirefoxDriver to pull up a web page and check the title on the page. When I run maven command mvn test this is all that I get:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building my-app 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # my-app ---
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/Andrew/Development/code/my-app/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) # my-app ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # my-app ---
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/Andrew/Development/code/my-app/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) # my-app ---
[WARNING] File encoding has not been set, using platform encoding MacRoman, i.e. build is platform dependent!
[INFO] Compiling 1 source file to /Users/Andrew/Development/code/my-app/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # my-app ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.049s
[INFO] Finished at: Fri Jan 31 11:53:38 EST 2014
[INFO] Final Memory: 12M/81M
[INFO] ------------------------------------------------------------------------
When I run the same Maven command in Eclipse, it shows the following:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building my-app 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # my-app ---
[debug] execute contextualize
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/Andrew/Development/code/my-app/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # my-app ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # my-app ---
[debug] execute contextualize
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/Andrew/Development/code/my-app/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # my-app ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # my-app ---
[INFO] Surefire report directory: /Users/Andrew/Development/code/my-app/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.878s
[INFO] Finished at: Fri Jan 31 11:58:23 EST 2014
[INFO] Final Memory: 5M/81M
[INFO] ------------------------------------------------------------------------
This is my pom.xml for those who want to check if that may be the issue:
<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>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>my-app</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.39.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire</artifactId>
<version>2.16</version>
<type>pom</type>
</dependency>
</dependencies>
</project>
Did you mean to add org.apache.maven.surefire as a POM dependency under <dependencies>?
Most usages of the Surefire plugin are configured under the <pluginManagement> section:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
</plugin>
</plugins>
</pluginManagement>
</build>

successfully building but the wsdl file not found?

i try to generate wsdl file using jaxws maven plugin
finaly:"successfully building" but my wsdl file is not generate, it is normaly in the folder \target\surefire-reports
but i don't have it after the building
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building BSCSwebservices Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.sun.xml.stream.buffer:streambuffer:jar:0.4 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.jvnet.staxex:stax-ex:jar:1.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # BSCSwebservices ---
[debug] execute contextualize
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 6 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # BSCSwebservices ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # BSCSwebservices ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\sayed\workspace\BSCSwebservices\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # BSCSwebservices ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # BSCSwebservices ---
[INFO] Surefire report directory: C:\Users\sayed\workspace\BSCSwebservices\target\surefire-reports
T E S T S
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) # BSCSwebservices ---
[INFO] Packaging webapp
[INFO] Assembling webapp [BSCSwebservices] in [C:\Users\sayed\workspace\BSCSwebservices\target\BSCSwebservices]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\sayed\workspace\BSCSwebservices\src\main\webapp]
[INFO] Webapp assembled in [1042 msecs]
[INFO] Building war: C:\Users\sayed\workspace\BSCSwebservices\target\BSCSwebservices.war
[WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored
(webxml attribute is missing from war task, or ignoreWebxml attribute is specified as 'true')
[INFO]
[INFO] --- jaxws-maven-plugin:1.11:wsgen (default) # BSCSwebservices ---
warning: The apt tool and its associated API are planned to be
removed in the next major JDK release. These features have been
superseded by javac and the standardized annotation processing API,
javax.annotation.processing and javax.lang.model. Users are
recommended to migrate to the annotation processing features of
javac; see the javac man page for more information.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:30.437s
[INFO] Finished at: Fri Aug 02 23:00:03 WAT 2013
[INFO] Final Memory: 16M/40M
[INFO] ------------------------------------------------------------------------
this a part of pom.xml
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.11</version>
<executions>
<execution>
<configuration>
<sei>com.ws.BillingAccountRead</sei>
<genwsdl>true</genwsdl>
<keep>true</keep>
</configuration>
<phase>package</phase>
<goals>
<goal>wsgen</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
when i use mvn clean package -X
<configuration>
<destDir default-value="${project.build.outputDirectory}"/>
<extension default-value="false"/>
<genWsdl default-value="false"/>
<keep default-value="false">true</keep>
<pluginArtifactMap>${plugin.artifactMap}</pluginArtifactMap>
<pluginArtifacts>${plugin.artifacts}</pluginArtifacts>
<project>${project}</project>
<resourceDestDir default-value="${project.build.directory}/jaxws/wsgen/wsdl"/>
<sei>com.ws.BillingAccountRead</sei>
<verbose default-value="false">true</verbose>
</configuration>
I would think you would want to build the wsdl in the 'generate-sources' phase or maybe 'generate-resources' instead of 'package'
It is supposed to generate the wsdl in ${resourceDestDir}
Configure it like below with verbose = true, and execute the mvn command with -X flag, then look the maven log carefully.
<executions>
<execution>
<configuration>
<sei>com.ws.BillingAccountRead</sei>
<genwsdl>true</genwsdl>
<keep>true</keep>
<verbose>true</verbose>
</configuration>
<phase>package</phase>
<goals>
<goal>wsgen</goal>
</goals>
</execution>
</executions>
Try to build using -X or -e to get more info from the log

Categories

Resources