22. September 2013

Deploy Spring application by Maven to Tomcat7 via HTTPS – PKIX problem

Simple scenario: deploy spring application to remote server which has https management interface.

Easy task. When you have properly configured project with pom.xml then you can use tomcat7 plugin for Maven.

Part of pom.xml

<plugin>
 <groupId>org.apache.tomcat.maven</groupId>
 <artifactId>tomcat7-maven-plugin</artifactId>
 <version>2.0-SNAPSHOT</version>
 <configuration>
  <path>/test</path>
  <!-- username and password must be set in ~/.m2/settings.xml -->
  <server>mytomcat</server>
  <!-- URL where Maven can find Tomcat 7 Manager -->
  <url>https://test.sinusgear.com:443/manager/text</url>
 </configuration>
</plugin>

Just run:

mvn tomcat7:deploy

Upload fails with error message:

PKIX path building failed

Ups. Not that easy? 🙂
The problem is that Java does not trust certificate of remote server.

Here is how to fix PKIX issue in Windows.

Open url of remote server by Firefox and save certificate to file.

Run PowerShell as administrator.

Go to directory with JDK cacets and import certificate. Default password is “changeit“.

cd C:\Program Files\Java\jdk1.7.0_40\jre\lib\security
keytool -import -alias test.sinusgear.com -keystore cacerts -file C:\Users\georgik\Documents\test.sinusgear.com

Done. Now you can start mvn tomcat7:deploy again.

13. November 2011

Apache Tomcat 7 Maven plugin

I was searching for Apache Tomcat 7 Maven plugin. I found only messages that no such thing exists and that I have to use some workaround. Finally I found link at StackOwerflow that pointed me to the testing version of  such a plugin.

You just need to configure repository and update mojo definition.

 <repositories>
    <repository>
      <id>people.apache.snapshots</id>
      <url>http://repository.apache.org/content/groups/snapshots-group/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>apache.snapshots</id>
      <name>Apache Snapshots</name>
      <url>http://repository.apache.org/content/groups/snapshots-group/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>
...
<plugin>
      <groupId>org.apache.tomcat.maven</groupId>
      <artifactId>tomcat7-maven-plugin</artifactId>
      <version>2.0-SNAPSHOT</version>
      <configuration>
        <path>/</path>
      </configuration>
    </plugin>

You can run Tomcat7 by: mvn tomcat7:run

You can read more about this new version of Tomcat Maven plugin at tomcat.apache.org.

This plugin is still under development.

BTW: List Maven plugins hosted at Apache.org is available at maven.apache.org/plugins.

21. October 2010

FlexMojos – off-line build

FlexMojos: How to build Flex application when you’re off-line? It’s quite easy, just add -o

mvn -o install

What to do when Maven is complaining about some plugin?

Go to your home directory. Enter .m2/repository, locate broken plugin and delete it. Maven will download those files again.

Previous part of screencast: How to build Flex app from command line.

17. October 2010

FlexMojos – how to build Flex app from command line

You can use FlexMojos to build Flex/AIR application on Linux, Windows or Mac.

Resources:

Put this application on web server and you will see statistics about IT Gigants.

Let me know if you have any questions.

You can find further information about Flex/AIR/Maven training at SinusGear.com.

10. August 2010

Automating Flex and AIR builds with Maven and Flexmojos

Update: fixed point of this article. 😉

It is daunting task to build project in Flash Builder over and over again, fix bugs, create build and produce release build. You change libs in your system and it screws up whole project and you have to start from the scratch 🙁 . It takes at least whole day to reestablish proper build environment.

Nightmare for developers,  lost budget and time for managers.

Adobe folks know this and they use Ant to build projects. Yea, it’s good, but little bit crude. It’s like moving from stone age to bronze age. It is BIG improvement once build.xml is in place and it saves a lot of time. But you have to find right Flex SDK, libraries, this swc, that swc, this certificate. Yay. Much better, just half a day is lost.

Java civilization already moved away from distant bronze-age and for several years they’ve been evolving Maven project. Ok, so how fast is Maven in establishing complete build environment? Very fast.

Download: Maven3, extract it, go to your project (with pom.xml), type e.g.: mvn install.

Bang! And you’ve got AIR package.

No manual downloads, no extraction of SDK, no manual copy of files back and forward.

Where is the hidden magic? It’s in Flexmojos project from Sonatype.

The only problem is to create good pom.xml. Stay tuned, there will be more articles about this topic. 🙂

  • Where’s the fish?

  • Translations

  • Further info

  • Twitter

    Follow @jurajmichalek on twitter.

  • Comments

  • Tags

  • Topics