I created a custom netbeans action using xml below.
<action>
<actionName>CUSTOM-mvn redeploy</actionName>
<displayName>mvn redeploy</displayName>
<properties>
<netbeans.deploy>true</netbeans.deploy>
<netbeans.deploy.debugmode>true</netbeans.deploy.debugmode>
</properties>
<goals>
<goal>compile</goal>
<goal>war:exploded</goal>
<goal>tomcat7:redeploy</goal>
</goals>
</action>
Problem is it undeploys the war when netbeans.deploy element is used.
tomcatManager status code:200, ReasonPhrase:OK
OK - Deployed application at context path /myservice
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 25.510 s
Finished at: 2015-07-28T14:51:21+08:00
Final Memory: 37M/367M
------------------------------------------------------------------------
NetBeans: Deploying on Apache Tomcat or TomEE
profile mode: false
debug mode: true
force redeploy: true
<b>Undeploying ...
undeploy?path=/myservice
OK - Undeployed application at context path /myservice
For anyone who might need this. Somehow I got this resolved by adding a profile in your pom.xml. The profile you added will then become a configuration. Add your custom actions to that configuration
<profiles>
<profile>
<id>dev</id>
<build>
<finalName>myservice</finalName>
</build>
</profile>
Not sure which version of Netbeans the author was using but, as of Netbeans 12.2, see: https://issues.apache.org/jira/browse/NETBEANS-5143.
Related
I am executing a Spring Boot application which takes up lot of time to create a SSL context.
Initial debugging points to method Security.getProviders() not returning the list of providers for around 8 minutes.
Provider[] providers = Security.getProviders();
This happens when I execute the JAR using below command on command prompt. But it does not take time when executed as Java Application via Eclipse of STS.
"Command to run Application"
java -DkeystoreFile=<Certificate File Name> -DkeystorePassword=<Password> -jar aws-sqs-consumer-0.0.1-SNAPSHOT.jar <QueueName> localhost false <proxy IP> <proxy Port>
Maven Pom.xml, uses spring boot maven plugin to build the application:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
I'd like to start a new local Tomcat instance for testing purposes during the Maven's pre-integration-test phase (on different port) and run tests there. Then if the tests pass I'd like to do a cargo:redeploy to a remote Tomcat instance. I'm having issues with getting this right though. If I do
mvn org.codehaus.cargo:cargo-maven2-plugin:run -Dcargo.maven.containerId=tomcat8x -Dcargo.maven.containerUrl=https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.36/bin/apache-tomcat-8.0.36.zip -Dcargo.maven.type=standalone
I get
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.19:run (default-cli) on project atf-relay-server: Execution default-cli of goal org.co
dehaus.cargo:cargo-maven2-plugin:1.4.19:run failed: Cannot create configuration. There's no registered configuration for the parameters (container [id = [tomcat
8x], type = [installed]], configuration type [runtime]). Valid types for this configuration are:
[ERROR] - standalone
[ERROR] - existing
[ERROR] -> [Help 1]
My pom.xml for cargo is (specifying only remote instance):
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.19</version>
<configuration>
<container>
<containerId>tomcat8x</containerId>
<type>remote</type>
</container>
<configuration>
<type>runtime</type>
<properties>
<cargo.hostname>localhost</cargo.hostname>
<cargo.servlet.port>9990</cargo.servlet.port>
<cargo.remote.username>user</cargo.remote.username>
<cargo.remote.password>pass</cargo.remote.password>
</properties>
</configuration>
<deployer>
<type>remote</type>
</deployer>
</configuration>
</plugin>
What's the correct way to achieve this?
Ok, seems it's quite easy to achieve after getting familiar with Maven profiles.
I have now one profile controlling remote Tomcat instance and doing the cargo:redeploy and other profile just creating local Tomcat, running it, deploying app there and running the tests.
While running mvn install on a fragment project in Eclipse I got this error:
${fragment name} cannot be installed in this environment because its filter is not applicable.
Using Eclipse-PlatformFilter: (osgi.os=macosx) in the Manifest breaks the build.
Here's the output surrounding the key error (IDs/directory names redacted):
[INFO] Resolving dependencies of MavenProject: ${fragmentID}:4.3.0-SNAPSHOT # ${fragmentDir}/pom.xml
[INFO] {osgi.os=linux, org.eclipse.update.install.features=true, osgi.arch=x86_64, osgi.ws=gtk}
[ERROR] Cannot resolve project dependencies:
[ERROR] Problems resolving provisioning plan.:
[ERROR] ${fragment name} cannot be installed in this environment because its filter is not applicable.
[ERROR]
[ERROR] See http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help.
The link (http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting) doesn't help.
I found a few similar errors on the internet (component X cannot be installed in this environment because its filter is not applicable), but they all apply to instances where it's downloaded software and there's either no solution or the solution isn't applicable to my case.
Grateful for any help!
Edit:
I found that using Eclipse-PlatformFilter: (osgi.os=macosx) in the host plugin works, and also Eclipse-PlatformFilter: (| (osgi.os=macosx) (osgi.os=linux) (osgi.os=win32) ) in the fragment works. It seems that the build goes through each environment set in an ancestor pom, and it breaks when the fragment doesn't apply for any one of those environments.... surely there's some flag I could set to prevent that?
Tycho builds for all the operating system environments configured through the POM. There is currently no way to automatically filter these environments to what is configured as Eclipse-PlatformFilter. So when building a fragment only for a certain operating system, you need to manually override the <environments> configuration from your parent POM in the POM of the fragment:
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<environments>
<environment>
<os>macosx</os>
<ws>cocoa</ws>
<arch>x86_64</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>
Is there a simple way (e.g., directly from tomcat7-maven-plugin configuration) to specify which JARs should be skipped during Tomcat startup in order to speed it up?
The Tomcat 7 documentation encourages to use a system property org.apache.catalina.startup.ContextConfig.jarsToSkip (see http://wiki.apache.org/tomcat/HowTo/FasterStartUp#JAR_scanning), but when set from maven configuration, it does not work.
After inspecting the sources of tomcat7-maven-plugin, I found a workaround to achieve jars skipping. (It may however stop working with future releases of Maven Tomcat 7 plugin.)
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<path>/${project.artifactId}</path>
<port>8080</port>
<systemProperties>
<org.apache.catalina.startup.ContextConfig.jarsToSkip>*</org.apache.catalina.startup.ContextConfig.jarsToSkip>
<!-- work around .. see: https://issues.apache.org/jira/browse/MTOMCAT-281 -->
<catalina.config>${project.baseUri}/target/tomcat/logs</catalina.config>
</systemProperties>
</configuration>
</plugin>
As described in a related bug (https://issues.apache.org/jira/browse/MTOMCAT-281), the problem is that Tomcat blindly overrides all system properties with properties from tomcat-embed-core-7.0.47.jar!/org/apache/catalina/startup/catalina.properties. As a result, the value of org.apache.catalina.startup.ContextConfig.jarsToSkip system property specified in plugin configuration is overridden.
I'm trying to deploy my project to Tomcat using Tomcat MVN plugin but I get the following error:
Uploading: http://localhost:8080/manager/text/deploy?path=%2FSample
Uploaded: http://localhost:8080/manager/text/deploy?path=%2FSample (90810 KB at 62283.7 KB/sec)
[ERROR] Tomcat return http status error: 404, Reason Phrase: Not Found
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
The plugin configuration in the pom
<build>
<plugins>
.
.
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
.
.
.
I have no Tomcat users set in the pom because in my Tomcat configuration I don't have any users and need to kept it that way.
When I manually copy the war into the tomcat folder "webapps" it deploy with no issue.
I don't know what is missing... and I have try the followings with no result
Error while deploying to Tomcat: tomcatManager status code:404, ReasonPhrase:Not Found
tomcatManager status code:404, ReasonPhrase:Not Found
Ok after a lot of research I found a way to deploy my project with Tomcat7 Maven Plugin.
It's as simple as running the goal mvn tomcat7:run-war
The only downside is that it use it own embedded Tomcat server
I leave the documentation here