Vaadin Custom Components/Widgets with Maven and Spring Boot - maven

I am relatively new to vaadin and started out with a spring boot application and the vaadin spring boot plugin. Everything worked fine until I got to the point where I tried to create my own components/widgets.
Unfortunately I didn't find any "official" example/documentation how to set up custom components within a spring boot application so I had to search the web to find out how to set up additional plugin(s) in maven to compile the code for the client side widgets. As far as I can tell from the log output the compilation of these components work, but when I try to access these components on the webpage I get an error:
Widgetset 'com.vaadin.DefaultWidgetSet' does not contain implementation for net.gtidev.test.components.MyComponent. Check its component connector's #Connect mapping, widgetsets GWT module description file and re-compile your widgetset. [...]
Here is the widget compiler log:
[INFO] Using com.vaadin:vaadin-client-compiler version 7.6.4
[ERROR] Mar 22, 2016 10:22:43 AM java.util.prefs.WindowsPreferences <init>
[ERROR] WARNUNG: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
[INFO] Compiling module net.gtidev.test.components.TestWidgetset
[INFO] Computing all possible rebind results for 'com.vaadin.client.metadata.ConnectorBundleLoader'
[INFO] Rebinding com.vaadin.client.metadata.ConnectorBundleLoader
[INFO] Invoking generator com.vaadin.server.widgetsetutils.ConnectorBundleLoaderFactory
[INFO] Populating eager bundle
. . . . . 250 more lines
[INFO] Computing all possible rebind results for 'com.vaadin.client.ui.dd.VAcceptCriterionFactory'
[INFO] Rebinding com.vaadin.client.ui.dd.VAcceptCriterionFactory
[INFO] Invoking generator com.vaadin.server.widgetsetutils.AcceptCriteriaFactoryGenerator
[INFO] Detecting available criteria ...
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.AcceptAll
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.And
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.ContainsDataFlavor
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.SourceIs
[INFO] creating mapping for com.vaadin.ui.AbstractSelect.TargetItemIs
[INFO] creating mapping for com.vaadin.ui.AbstractSelect.AcceptItem
[INFO] creating mapping for com.vaadin.ui.Table.TableDropCriterion
[INFO] creating mapping for com.vaadin.ui.Tree.TreeDropCriterion
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.Not
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.Or
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.ServerSideCriterion
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.SourceIsTarget
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.TargetDetailIs
[INFO] creating mapping for com.vaadin.ui.Tree.TargetInSubtree
[INFO] Done. (0seconds)
[INFO] Compiling 1 permutation
[INFO] Compiling permutation 0...
[INFO] Compile of permutations succeeded
[INFO] Compilation succeeded -- 59,217s
[INFO] Linking into C:\projects\misc\vaadin-boot\target\vaadin-boot-0.0.1-SNAPSHOT\net.gtidev.test.components.TestWidgetset
[INFO] Link succeeded
[INFO] Linking succeeded -- 0,492s
The files I use for my custom component were generated by the eclipse vaadin addon within a vaadin 7 project which I created only for this purpose. When I started this vaadin 7 project in eclipse the component worked. I then copied these files into my spring boot maven project where the custom component does not get loaded any more.
I know that spring boot applications have a slightly different bootstrap mechanism and layout than "classic" webapps and that amongst other things static resources are not loaded from the webapp-folder but from the classpath:/static folder. I think that the core of the problem has something to do with this fact but I don't know what to do to fix it.
My Plugin configuration (I tried with and without the commented options):
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>7.6.4</version>
<configuration>
<strict>true</strict>
<force>true</force>
<!-- Enable during development to speed compiling. -->
<!-- <draftCompile>true</draftCompile>
<style>DETAILED</style> -->
<!-- End development options -->
<!--<webappDirectory>src/main/webapp/VAADIN/widgetsets</webappDirectory>-->
<modules>
<module>net.gtidev.test.components.TestWidgetset</module>
</modules>
</configuration>
<executions>
<execution>
<goals>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
I tried different maven plugin combinations and configurations. In one example, there was also a Google-GWT Plugin mentioned, but running this plugin on the code produced the same log output as the vaadin plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.5.1</version>
<!--<configuration>-->
<!--<webappDirectory>src/main/webapp/VAADIN/widgetsets</webappDirectory>-->
<!--<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>-->
<!--<runTarget>clean</runTarget>-->
<!--<hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp>-->
<!--<noServer>true</noServer>-->
<!--<port>8080</port>-->
<!--<soycDetailed>false</soycDetailed>-->
<!--</configuration>-->
<executions>
<execution>
<goals>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>

To use custom client side extensions, Vaadin Add-ons, you'll need to add vaadin-maven-plugin to your project. It will scan the add-ons you use and GWT compile a new widgetset for your project that contains those extensions.
If you created the project with start.spring.io the maven plugin is not in your project by default. Create an example project for example using this Vaadin+Spring archetype or the official servlet based archetype and copy the vaadin-maven-plugin related parts from the pom.xml to your projects pom.xml. Then do a full build and everything should works as expected.

Related

How do I specify the type of asset when I publish asset to mulesoft's exchange?

When I was building a CI/CD with github actions, I ran into the following problems.
[INFO] ------------------------------------------------------------
[INFO] Publication status: error
[INFO] ------------------------------------------------------------
[INFO] Steps:
[INFO] - Description: Publishing asset
[INFO] - Status: error
[INFO] - Errors: [The asset is invalid, Error while trying to set type: app. Expected type is: rest-api.]
[INFO] .........................................
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
The following is my maven configuration
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-maven-plugin</artifactId>
<version>${mule.maven.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<sharedLibraries>
<sharedLibrary>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
</sharedLibrary>
</sharedLibraries>
<cloudhub2Deployment>
<uri>https://anypoint.mulesoft.com</uri>
<provider>MC</provider>
<environment>DEV</environment>
<target>****</target>
<muleVersion>4.4.0</muleVersion>
<server>anypoint-exchange-v3</server>
<businessGroup>AAAA</businessGroup>
<businessGroupId>*********</businessGroupId>
<applicationName>test-app2023</applicationName>
<replicas>1</replicas>
<vCores>0.1</vCores>
<deploymentSettings>
<http>
<inbound>
<publicUrl>tes-app2023t.anypoint.com</publicUrl>
</inbound>
</http>
<lastMileSecurity>false</lastMileSecurity>
<forwardSslSession>false</forwardSslSession>
<generateDefaultPublicUrl>true</generateDefaultPublicUrl>
</deploymentSettings>
<server>****</server>
<properties>
<anypoint.platform.base_uri>https://anypoint.mulesoft.com/</anypoint.platform.base_uri>
<anypoint.platform.client_id>****</anypoint.platform.client_id>
<anypoint.platform.client_secret>****</anypoint.platform.client_secret>
<anypoint.platform.analytics_base_uri>https://analytics-ingest.anypoint.mulesoft.com</anypoint.platform.analytics_base_uri>
</properties>
</cloudhub2Deployment>
<classifier>mule-application</classifier>
</configuration>
</plugin>
How should I properly set my exchange asset to rest-api instead of app?
I checked mulesoft's documentation and couldn't find a way to define...
The Mule Maven Plugin shared is configured for a Mule application. The asset type is set by the <classifier> element. Since this is a Mule application it is a correct type. In Anypoint Exchange a rest-api asset type identify an API description composed of RAML or OAS files. The Mule Maven Plugin is not compatible with that kind of assets, which makes sense because they are not built with Maven. If the Mule application implements a REST API, it is still a Mule application asset.
On the other hand if your asset is really RAML or OAS files you should use the Anypoint CLI instead to publish it to Anypoint Exchange. Read https://docs.mulesoft.com/exchange/to-create-an-asset for the different ways to create different types of assets.
I solved this problem myself.
The problem was caused by the duplication of the asset name of the API (raml) published from Design center and the asset name of the API (app) published from Maven.
I changed the artifactId in the pom.xml and solved the problem.
<groupId>****</groupId>
<artifactId>{asset name}</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>mule-application</packaging>

Maven build hangs during build

Whenever I run the maven build on my POM.xml, the build just hangs and the laptop becomes unresponsive. The last lines I always see are:
[INFO] --- filevault-package-maven-plugin:1.0.3:check-signature (default-check-signature) # my-project.ui.apps ---
[INFO] No signature defined. Skipping signature check.
[INFO]
[INFO] --- filevault-package-maven-plugin:1.0.3:analyze-classes (default-analyze-classes) # my-project.ui.apps ---
[INFO] Analyzing java package dependencies.
The plugin configuration in my POM file is below:
<plugin>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>filevault-package-maven-plugin</artifactId>
<version>1.0.3</version>
<configuration>
<filterSource>src/main/content/META-INF/vault/filter.xml</filterSource>
<failOnDependencyErrors>false</failOnDependencyErrors>
</configuration>
</plugin>
I am trying to build this using archetype 22. The same code and dependencies worked fine in archetype 13 project earlier.

nexus-staging-maven-plugin refuse to upload after deferred deployment

I have a multi-module project that has nexus-staging-maven-plugin configured in parent pom.xml:
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.6</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<!--<autoReleaseAfterClose>true</autoReleaseAfterClose>-->
</configuration>
</plugin>
By default it should be inherited by all submodules (except those disabled using technique in How to disable nexus-staging-maven-plugin in sub-modules)
However, when I start deployment:
mvn clean deploy -DskipTests=true -Prelease-sign-artifacts -Dgpg.passphrase=*****
I see the following message:
[INFO] Installing Nexus Staging features:
[INFO] ... total of 5 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
...
[INFO] --- nexus-staging-maven-plugin:1.6.6:deploy (injected-nexus-deploy) # spookystuff-core ---
[INFO] Performing deferred deploys (gathering into "/home/peng/git/spookystuff/target/nexus-staging/deferred")...
[INFO] Installing /home/peng/git/spookystuff/core/target/spookystuff-core-0.3.2-SNAPSHOT.jar to /home/peng/git/spookystuff/target/nexus-staging/deferred/com/tribbloids/spookystuff/spookystuff-core/0.3.2-SNAPSHOT/spookystuff-core-0.3.2-SNAPSHOT.jar
...
[INFO] Reactor Summary:
...
[INFO] BUILD SUCCESS
No upload happens whatsoever. The artifact that should be uploaded to nexus were still cached under:
/target/nexus-staging/deferred
but neither the log nor nexus server record indicates that it has been uploaded. What has been wrong here and what should I do to fix it?

How to revert Maven project.build variables after Clover plugin finishes?

I'm attempting to add integration tests to a large Maven project. Here is the desired order of events:
Clean existing artifacts.
Resolve dependencies and build project.
Run unit tests via Surefire plugin.
Fork lifecycle for Clover plugin.
--- Instrument sources using Clover plugin.
--- Modify project.build.directory and project.build.finalName for Clover.
--- Build Clover instrumented project in a new directory.
--- Run Clover instrumented unit tests via Surefire plugin.
--- Check code coverage from Clover instrumented unit tests.
--- Reset project.build.directory and project.build.finalName to original values.
--- End forked lifecycle (Clover only forks through 'test' phase).
Package project as a WAR file.
Locally host project WAR file via Tomcat7 plugin.
Run integration tests against Tomcat7 instance via Surefire plugin.
All of this works as expected except step #9 (hence the question). Instead, the build directory is still set to the Clover version, and the project name has "-clover" appended to it. I've also found that when "MyProject-clover.war" is hosted by Tomcat7 that it does not function as expected (returns a 404 error in the browser).
Even if it did work, We do not need/want Clover instrumentation in the WAR file which we're testing against because the integration tests don't touch any of the production code (it's all Selenium UI stuff under src/test/java which interacts with the locally hosted pages instead of the production code itself).
As mentioned, this is a large project containing hundreds of dependencies and dozens of plugins. I believe the following are relevant to my issue, though I can dig up more if necessary (posting the entire pom file seems unreasonable).
Here's the pom configuration for the Clover plugin:
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>
<version>3.1.11</version>
<configuration>
<generateHtml>true</generateHtml>
<generateXml>true</generateXml>
<licenseLocation>${basedir}/src/test/resources/clover.license</licenseLocation>
<targetPercentage>92%</targetPercentage>
<excludes>
<exclude>**/mock/*.java</exclude>
<exclude>**/com/mycompany/somestuff/*.java</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>generate-clover-report</id>
<phase>test</phase>
<goals>
<goal>instrument</goal>
<goal>clover</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
Here's the pom configuration for the WAR plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<finalName>${project.artifactId}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<!--Implementation-Build>${buildNumber}_${timestamp}</Implementation-Build -->
<Build-Time>${timestamp}</Build-Time>
</manifestEntries>
</archive>
</configuration>
</plugin>
Here's the pom configuration for the Tomcat7 plugin:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<ajpPort>8009</ajpPort>
<backgroundProcessorDelay>2</backgroundProcessorDelay>
<configurationDir>${project.build.directory}/tomcat7_plugin</configurationDir>
<contextFile>${CATALINA_HOME}/conf/context.xml</contextFile>
<contextReloadable>false</contextReloadable>
<fork>true</fork>
<hostName>localhost</hostName>
<httpsPort>8443</httpsPort>
<ignorePackaging>false</ignorePackaging>
<jarScanAllDirectories>false</jarScanAllDirectories>
<path>/contentmain</path>
<port>8080</port>
<serverXml>${CATALINA_HOME}/conf/server.xml</serverXml>
<tomcatUsers>${CATALINA_HOME}/conf/tomcat-users.xml</tomcatUsers>
<tomcatWebXml>${CATALINA_HOME}/conf/web.xml</tomcatWebXml>
<useNaming>true</useNaming>
<useTestClasspath>true</useTestClasspath>
<update>true</update>
<warDirectory>${project.build.directory}/${project.build.finalName}</warDirectory>
</configuration>
<executions>
<execution>
<id>start-tomcat</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run-war-only</goal>
</goals>
<configuration>
<fork>true</fork>
</configuration>
</execution>
<execution>
<id>stop-tomcat</id>
<phase>post-integration-test</phase>
<goals>
<goal>shutdown</goal>
</goals>
</execution>
</executions>
</plugin>
Here's the current (desired) behavior when I run "mvn clean install -Dmaven.clover.skip":
[INFO] --- maven-clover2-plugin:3.1.11:check (generate-clover-report) # MyProject ---
[INFO]
[INFO] --- maven-dependency-plugin:2.1:unpack (unpack) # MyProject ---
[INFO] Configured Artifact: com.mycompany:somedependency:?:jar
[INFO] Configured Artifact: com.mycompany:somedependency:?:jar
[INFO] Configured Artifact: com.mycompany:somedependency:?:jar
[INFO] Unpacking /mydir/.m2/myrepo/mycompany/somedir/somedependency.jar to mydir/MyProject/target/MyProject with includes css/*.css and excludes:null
[INFO] Unpacking /mydir/.m2/myrepo/mycompany/somedir/somedependency.jar to mydir/MyProject/target/MyProject with includes scripts/*/*.* and excludes:null
[INFO] Unpacking /mydir/.m2/myrepo/mycompany/somedir/somedependency.jar to mydir/MyProject/target/MyProject with includes images/*.* and excludes:null
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) # MyProject ---
[INFO] Packaging webapp
[INFO] Assembling webapp [MyProject] in [mydir/MyProject/target/MyProject]
[INFO] Processing war project
[INFO] Copying webapp resources [mydir/MyProject/src/main/webapp]
[INFO] Webapp assembled in [2019 msecs]
[INFO] Building war: /mydir/MyProject/target/MyProject.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] >>> maven-source-plugin:2.2.1:jar (default) # MyProject >>>
[INFO]
[INFO] --- maven-dependency-plugin:2.1:copy (default) # MyProject ---
[INFO]
[INFO] --- buildnumber-maven-plugin:1.1:create-timestamp (default) # MyProject ---
[INFO]
[INFO] <<< maven-source-plugin:2.2.1:jar (default) # MyProject <<<
[INFO]
[INFO] --- maven-source-plugin:2.2.1:jar (default) # MyProject ---
[INFO] Building jar: /mydir/MyProject/target/MyProject-sources.jar
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:run-war-only (start-tomcat) # MyProject ---
[INFO] Running war on http://localhost:8080/contentmain
Here's the current (undesired) behavior when I run "mvn clean install" (note the paths listed by maven-war-plugin and warning message from maven-source-plugin:
[INFO] --- maven-clover2-plugin:3.1.11:check (generate-clover-report) # MyProject ---
[INFO]
[INFO] --- maven-dependency-plugin:2.1:unpack (unpack) # MyProject ---
[INFO] Configured Artifact: com.mycompany:somedependency:?:jar
[INFO] Configured Artifact: com.mycompany:somedependency:?:jar
[INFO] Configured Artifact: com.mycompany:somedependency:?:jar
[INFO] Unpacking /mydir/.m2/myrepo/mycompany/somedir/somedependency.jar to mydir/MyProject/target/MyProject with includes css/*.css and excludes:null
[INFO] Unpacking /mydir/.m2/myrepo/mycompany/somedir/somedependency.jar to mydir/MyProject/target/MyProject with includes scripts/*/*.* and excludes:null
[INFO] Unpacking /mydir/.m2/myrepo/mycompany/somedir/somedependency.jar to mydir/MyProject/target/MyProject with includes images/*.* and excludes:null
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) # MyProject ---
[INFO] Packaging webapp
[INFO] Assembling webapp [MyProject] in [mydir/MyProject/target/clover/MyProject-clover]
[INFO] Processing war project
[INFO] Copying webapp resources [mydir/MyProject/src/main/webapp]
[INFO] Webapp assembled in [1770 msecs]
[INFO] Building war: /mydir/MyProject/target/clover/MyProject-clover.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] >>> maven-source-plugin:2.2.1:jar (default) # MyProject >>>
[INFO]
[INFO] --- maven-dependency-plugin:2.1:copy (default) # MyProject ---
[INFO]
[INFO] --- buildnumber-maven-plugin:1.1:create-timestamp (default) # MyProject ---
[INFO]
[INFO] <<< maven-source-plugin:2.2.1:jar (default) # MyProject <<<
[INFO]
[INFO] --- maven-source-plugin:2.2.1:jar (default) # MyProject ---
[WARNING] NOT adding sources to artifacts with classifier as Maven only supports one classifier per artifact. Current artifact [com.mycompany:MyProject:war:clover:ParentProject-SNAPSHOT] has a [clover] classifier.
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:run-war-only (start-tomcat) # MyProject ---
[INFO] Running war on http://localhost:8080/contentmain
What can I do to make sure that the {project.build.directory} and {project.build.finalName} values are reset to their original values after Clover has finished executing the maven-clover2-plugin:check goal during the test phase of the forked lifecycle?
I've already tried browsing the online manuals for Clover, the WAR plugin, and Tomcat7. I see no mention of any settings I can use to revert the build variables that are altered by Clover. I can always hard-code the paths in my pom file, but I'd prefer a less brittle solution.
[INFO] --- maven-source-plugin:2.2.1:jar (default) # MyProject ---
[WARNING] NOT adding sources to artifacts with classifier as Maven only supports one classifier per artifact. Current artifact [com.mycompany:MyProject:war:clover:ParentProject-SNAPSHOT] has a [clover] classifier.
This is a limitation of Maven. It does not support artifacts with multiple classifiers. As the artifact in a forked life cycle has the "clover" classifier already, it cannot have "source" classifier at the same time. That's why this warning is present. You may consider using the clover2:setup instead of the clover2:instrument if you need to call a maven-source-plugin.
4. Fork lifecycle for Clover plugin.
--- End forked lifecycle (Clover only forks through 'test' phase).
There are two Clover goals which forks a build:
clover2:instrument - forks a build till the 'install' phase
clover2:instrument-test - forks a build till the 'test' phase
You may be interested in the latter one. You may also be interested in using the useCloverClassifier=false option - this will disable usage of the "clover" classifier in a forked build.
I've also found that when "MyProject-clover.war" is hosted by Tomcat7 that it does not function as expected (returns a 404 error in the browser).
My first guess is that you have clover.jar (com.atlassian.clover:clover) missing at runtime. You have to either copy clover.jar to Tomcat's /lib directory or to bundle it in your WAR. See https://confluence.atlassian.com/display/CLOVER/Using+Clover+for+web+applications
It turns out that Clover will always alter these variables unless the clover2:setup target is used. However, if you still wish to fork the lifecycle for Clover (IE: clover2:instrument or clover2:instrument-test) then these variables will always be altered.
We wish to continue forking the lifecycle using clover:instrument-test, so I've come up with a workaround. Instead of using the project.build.finalName and project.build.directory variables, I'm using my own variables that get copied and saved on Maven execution before Clover can mess with them:
<properties>
<!-- Saving these variables now before Clover alters them -->
<original.build.finalName>${project.build.finalName}</original.build.finalName>
<original.build.directory>${project.build.directory}</original.build.directory>
</properties>
I then tell all of the subsequent plugins to use these variables instead of the project variables which Clover has altered:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<cacheFile>${original.build.directory}/war/work/webapp-cache.xml</cacheFile>
<outputDirectory>${original.build.directory}</outputDirectory>
<warName>${original.build.finalName}</warName>
<webappDirectory>${original.build.directory}/${original.build.finalName}</webappDirectory>
<workDirectory>${original.build.directory}</workDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<configurationDir>${original.build.directory}/tomcat7_plugin</configurationDir>
<warDirectory>${original.build.directory}/${original.build.finalName}</warDirectory>
</configuration>
</plugin>
</plugins>
Alternative solutions might include creating or utilizing an additional plugin in a subsequent Maven phase to revert the project.build variables after Clover has finished executing. Either of these solutions is probably better than hard-coding the paths in all of your plugins.

maven-war-plugin maven-compiler-plugin

i'm new to maven; I need to compile and packaging 2 war file in two different directory even if the source are the same (change only the web.xml file).
try to explain better:
directory structure of LT:
<DIR> LT1_war
<DIR> LT_war
pom.xml
a part of the pom is:
<modules>
<module>LT_war</module>
<module>LT1_war</module>
</modules>
inside the folder LT_war there is a pom and src-->main-->java
resources
webapp
this compile successful and also i packaging in a war LT_war (to deploy to tomcat)
I need a way in order to compile inside the directory LT1_war (using the source that are in the LT_war directory) and packaging using the webapp inside the LT_war directory (just changing the web.xml file)
I've try to write the pom inside the directory LT1_war but when i lunch mvn packaging it tell me:
[INFO] lt ................................................ SUCCESS [3.995s]
[INFO] LT ................................................ SUCCESS [1:12.629s]
[INFO] LT1 ............................................... FAILURE [41.367s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:59.716s
[INFO] Finished at: Tue Jul 08 23:50:43 CEST 2014
[INFO] Final Memory: 20M/200M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.0:war (default-war) on project LT1: Error assembling WAR: Deployment descriptor: D:\attivi
taTomcat7\LT\LT1_war\target\LT1\WEB-INF\web.xml does not exist. -> [Help 1]:
this is a part of the pom file inside LT1_war:
<build>
<finalName>LT1</finalName>
<resources>
<resource>
<directory>../LT_war/src/</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0</version>
<configuration>
<excludes>**/.svn/**</excludes>
</configuration>
<executions>
<execution>
<id>exploded</id>
<phase>prepare-package</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
<execution>
<id>war</id>
<phase>package</phase>
<goals>
<goal>war</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
There is a few things that I kindly consider terribly wrong with what you're doing:
A Maven project should never access files that are outside of its own module's folder. So LT1 please stay out of LT's folder!
Try to keep WAR projects small if you can. Modularize your code anyway, and make the WAR just depend on JAR files that contain the actual meat
One WAR file "borrowing" stuff from the other WAR might then be better fixed by having both WAR files depend on the code that you moved into such JAR file(s)
Stop using Java 5 if you reasonably can; it's been EOL since 2009. Also, consider moving your source/target levels to the parent project, so you don't redefine the same, yet have a consistent Java version
Talking about old versions, how come you even still have .svn folders that you need to exclude (for a while now there's only a .svn folder in the root of your Subversion work space, that wouldn't affect the Maven WAR plugin)
So your project structure could look like this:
ROOT
MEAT (packaging JAR, where your classes live)
LT (packaging WAR, depends on MEAT)
LT1 (packaging WAR, depends on MEAT, and stays the heck out of LT)
Addition (forgotten some aspect, as pointed out in comment)...
While MEAT is of packaging JAR, you want it to also include stuff that you had going into webapp without it ending up on the classpath. Provided you're using a fairly recent servlet-api, this can be achieved by giving MEAT a resources folder as follows:
src/main/resources/META-INF/resources/...
E.g. .../META-INF/resources/flower.jpeg will appear in the deployed WAR as <context root>/flower.jpg (instead of it just being added to the Java class path).
I need a way in order to compile inside the directory LT1_war (using the source that are in the LT_war directory) and packaging using the webapp inside the LT_war directory (just changing the web.xml file)
Generally, you compile from the root. It's not convenient to do what you're asking to do but it can be done by using the --also-make command line option.

Resources