Before releasing a mavenized web project plus Vaadin, several problems popped up because the modification of sources made by Vaadin compilations.
Finally the solution was to exclude the problematic part that always is regenerated if it does not exist anyway:
------------------------------------------------------------------------
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>
<configuration>
<providerImplementations>
<svn>javasvn</svn>
</providerImplementations>
<autoVersionSubmodules>true</autoVersionSubmodules>
<tagNameFormat>v@{project.version}</tagNameFormat>
<checkModificationExcludes>
<checkModificationExclude>${project.build.outputDirectory}/**/VAADIN/**</checkModificationExclude>
</checkModificationExcludes>
<configuration>
<preparationGoals>clean verify</preparationGoals>
</configuration>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.code.maven-scm-provider-svnjava</groupId>
<artifactId>maven-scm-provider-svnjava</artifactId>
<version>2.1.1</version>
</dependency>
</dependencies>
</plugin>
------------------------------------------------------------------------
Enjoy!
Showing posts with label maven. Show all posts
Showing posts with label maven. Show all posts
2014/04/02
2014/02/27
Unable to tag SCM with maven-release-plugin
An incomplete layout in your subversion repository may be one of the causes for this error:
mvn release:clean -e
mvn release:prepare --batch-mode -e
mvn release:perform -e
------------------------------------------------
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.4.2:prepare (default-cli) on project geoemissions: Unable to tag SCM
Provider message:
The svn tag command failed.
Command output:
svn: '/svn/sources/GeoEmissions/!svn/bc/91/tags' path not found
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
------------------------------------------------
Similar error with scm:
mvn scm:tag -Dtag="Test"
------------------------------------------------
[ERROR] Provider message:
[ERROR] SVN tag failed.
[ERROR] Command output:
[ERROR] svn: E160013: Path 'http://svn.geoaire.cl/svn/sources/YourProject/tags/v0.01' does not exist in revision 91
------------------------------------------------
My project was up and running in the trunk, what else was I going to need? Maybe tags and branches? :-)
From now and on I rather prepare a shellscript (that I version too) to build up my projects in the very beginning with this three important directories:
------------------------------------------------
WORKSPACE=/srv/svn/repositories/sources/YourProject
mkdir -p $WORKSPACE
svnadmin create --fs-type fsfs $WORKSPACE
chmod 770 -R $WORKSPACE
svn mkdir file:///srv/svn/repositories/sources/YourProject/{trunk,tags,branches}
------------------------------------------------
After the doing the "svn mkdir", the two plugins worked well. This was my configuration:
------------------------------------------------
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.9</version>
<configuration>
<providerImplementations>
<svn>javasvn</svn>
</providerImplementations>
<connectionType>developerConnection</connectionType>
<username>xxx</username>
<password>yyy</password>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.code.maven-scm-provider-svnjava</groupId>
<artifactId>maven-scm-provider-svnjava</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<providerImplementations>
<svn>javasvn</svn>
</providerImplementations>
<autoVersionSubmodules>true</autoVersionSubmodules>
<tagNameFormat>v@{project.version}</tagNameFormat>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.code.maven-scm-provider-svnjava</groupId>
<artifactId>maven-scm-provider-svnjava</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>
</plugin>
------------------------------------------------
Enjoy!
mvn release:clean -e
mvn release:prepare --batch-mode -e
mvn release:perform -e
------------------------------------------------
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.4.2:prepare (default-cli) on project geoemissions: Unable to tag SCM
Provider message:
The svn tag command failed.
Command output:
svn: '/svn/sources/GeoEmissions/!svn/bc/91/tags' path not found
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
------------------------------------------------
Similar error with scm:
mvn scm:tag -Dtag="Test"
------------------------------------------------
[ERROR] Provider message:
[ERROR] SVN tag failed.
[ERROR] Command output:
[ERROR] svn: E160013: Path 'http://svn.geoaire.cl/svn/sources/YourProject/tags/v0.01' does not exist in revision 91
------------------------------------------------
My project was up and running in the trunk, what else was I going to need? Maybe tags and branches? :-)
From now and on I rather prepare a shellscript (that I version too) to build up my projects in the very beginning with this three important directories:
------------------------------------------------
WORKSPACE=/srv/svn/repositories/sources/YourProject
mkdir -p $WORKSPACE
svnadmin create --fs-type fsfs $WORKSPACE
chmod 770 -R $WORKSPACE
svn mkdir file:///srv/svn/repositories/sources/YourProject/{trunk,tags,branches}
------------------------------------------------
After the doing the "svn mkdir", the two plugins worked well. This was my configuration:
------------------------------------------------
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.9</version>
<configuration>
<providerImplementations>
<svn>javasvn</svn>
</providerImplementations>
<connectionType>developerConnection</connectionType>
<username>xxx</username>
<password>yyy</password>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.code.maven-scm-provider-svnjava</groupId>
<artifactId>maven-scm-provider-svnjava</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<providerImplementations>
<svn>javasvn</svn>
</providerImplementations>
<autoVersionSubmodules>true</autoVersionSubmodules>
<tagNameFormat>v@{project.version}</tagNameFormat>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.code.maven-scm-provider-svnjava</groupId>
<artifactId>maven-scm-provider-svnjava</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>
</plugin>
------------------------------------------------
Enjoy!
2011/09/09
Sending an email using maven-postman-plugin and smtp.gmail.com
I configured maven to send a notification after deploying successfully an artifact.
Because this is done from my home server I chose to use gmail as my smtp server:
</configuration>
</execution>
</executions>
</plugin>
Important:
a) Put the declaration after the deployment declaration, this way if something goes wrong the email will not be send.
b) The <inherited> mark is needed only if you put this declaration in some parent pom and another child module is the deployed one. To maintain the order you may have to put the main declaration of your deployment first in the parent pom. Remember that "The order of execution depends on the order in which the goal(s) and the build phase(s) are invoked".
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>upload</id>
<phase>deploy</phase>
</execution>
</executions>
</plugin>
c) The plugin didn't work until I declared the <mailAltConfig> (check out this and this).
In my case I only send the email when "production" deployment is done (I love profiles!).
What about this?
mvn deploy -Pprod
Nice!
Because this is done from my home server I chose to use gmail as my smtp server:
<plugin>
<groupId>ch.fortysix</groupId>
<artifactId>maven-postman-plugin</artifactId>
<version>0.1.6</version>
<executions>
<execution>
<id>send_an_email</id>
<phase>deploy</phase>
<goals>
<goal>send-mail</goal>
</goals>
<inherited>true</inherited>
<configuration>
<mailhost>smtp.gmail.com</mailhost>
<mailport>465</mailport>
<mailssl>true</mailssl>
<mailAltConfig>true</mailAltConfig>
<mailuser>your_gmail_emailer_account@gmail.com</mailuser>
<mailpassword>your_gmail_emailer_password</mailpassword>
<from>your_gmail_emailer_account@gmail.com</from>
<receivers>
<receiver>some_receiver@mail.domain</receiver>
<receiver>some_another_receiver@gmail.com</receiver>
</receivers>
<subject>Important subject</subject>
<failonerror>true</failonerror>
<htmlMessage>
<![CDATA[
<groupId>ch.fortysix</groupId>
<artifactId>maven-postman-plugin</artifactId>
<version>0.1.6</version>
<executions>
<execution>
<id>send_an_email</id>
<phase>deploy</phase>
<goals>
<goal>send-mail</goal>
</goals>
<inherited>true</inherited>
<configuration>
<mailhost>smtp.gmail.com</mailhost>
<mailport>465</mailport>
<mailssl>true</mailssl>
<mailAltConfig>true</mailAltConfig>
<mailuser>your_gmail_emailer_account@gmail.com</mailuser>
<mailpassword>your_gmail_emailer_password</mailpassword>
<from>your_gmail_emailer_account@gmail.com</from>
<receivers>
<receiver>some_receiver@mail.domain</receiver>
<receiver>some_another_receiver@gmail.com</receiver>
</receivers>
<subject>Important subject</subject>
<failonerror>true</failonerror>
<htmlMessage>
<![CDATA[
<p>Partner, we have a new deployment!</p>
<br>
<p>Have a nice day.</p>
]]>
</htmlMessage><br>
<p>Have a nice day.</p>
]]>
</configuration>
</execution>
</executions>
</plugin>
Important:
a) Put the declaration after the deployment declaration, this way if something goes wrong the email will not be send.
b) The <inherited> mark is needed only if you put this declaration in some parent pom and another child module is the deployed one. To maintain the order you may have to put the main declaration of your deployment first in the parent pom. Remember that "The order of execution depends on the order in which the goal(s) and the build phase(s) are invoked".
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>upload</id>
<phase>deploy</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>ch.fortysix</groupId>
<artifactId>maven-postman-plugin</artifactId>
<groupId>ch.fortysix</groupId>
<artifactId>maven-postman-plugin</artifactId>
...
...
...
</plugin> c) The plugin didn't work until I declared the <mailAltConfig> (check out this and this).
In my case I only send the email when "production" deployment is done (I love profiles!).
What about this?
mvn deploy -Pprod
Nice!
2011/07/14
Assembling an executable jar into a timestamped package
I needed to build a package for an executable jar containing all its dependencies, in bzip2 format and with a time stamp in the file-name. This is how a did it:
To generate the time stamp I chose gmaven-plugin but you can use the buildnumber-maven-plugin if you need to relate some build number with your control version system (svn maybe?). Futhermore gmaven is a whole new tool box for a developer!
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>set-timestamp</id>
<phase>initialize</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
def timestamp = new Date().format('yyyyMMdd-HHmmss')
project.properties.setProperty('timestamp', timestamp)
</source>
</configuration>
</execution>
</executions>
</plugin>
To assembly the package the job is done in two parts: first, the jar must be generated with a manifest declaring the main class to execute and the jar must contain all the dependencies needed to run. Second, the compressed file containing the jar and some shell scripts must be named using a time stamp
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>org.project.bla.bla.bla.ui.cli.Main</mainClass>
</manifest>
</archive>
</configuration>
</execution>
<execution>
<id>dist</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>ProjectXYZ-${project.version}-${timestamp}</finalName>
<descriptors>
<descriptor>src/main/assembly/distributable.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
Here an assembly descriptor comes to help, we include some shell scripts and specify output format:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>dist</id>
<includeBaseDirectory>true</includeBaseDirectory>
<formats>
<format>tar.bz2</format>
</formats>
<fileSets>
<fileSet>
<includes>
<include>**/**jar-with-dependencies.jar</include>
</includes>
<outputDirectory>bin</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.basedir}/misc/shellScripts</directory>
<fileMode>0755</fileMode>
<lineEnding>lf</lineEnding>
<includes>
<include>*</include>
</includes>
<outputDirectory>bin</outputDirectory>
</fileSet>
</fileSets>
</assembly>
Of course, the assembly descriptor must located in the place declared:

This, you can build packages like this: ProjectXYZ/target/ProjectXYZ-1.0-SNAPSHOT-20110714-221041-dist.tar.bz2
mvn package
The jar would be called like this:
java -jar ProjectXYZ-1.0-SNAPSHOT-jar-with-dependencies.jar
What a ugly name, maybe I need a installer or a shell script as a wrapper:
Ok, I need a installer.
To generate the time stamp I chose gmaven-plugin but you can use the buildnumber-maven-plugin if you need to relate some build number with your control version system (svn maybe?). Futhermore gmaven is a whole new tool box for a developer!
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>set-timestamp</id>
<phase>initialize</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
def timestamp = new Date().format('yyyyMMdd-HHmmss')
project.properties.setProperty('timestamp', timestamp)
</source>
</configuration>
</execution>
</executions>
</plugin>
To assembly the package the job is done in two parts: first, the jar must be generated with a manifest declaring the main class to execute and the jar must contain all the dependencies needed to run. Second, the compressed file containing the jar and some shell scripts must be named using a time stamp
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>org.project.bla.bla.bla.ui.cli.Main</mainClass>
</manifest>
</archive>
</configuration>
</execution>
<execution>
<id>dist</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>ProjectXYZ-${project.version}-${timestamp}</finalName>
<descriptors>
<descriptor>src/main/assembly/distributable.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
Here an assembly descriptor comes to help, we include some shell scripts and specify output format:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>dist</id>
<includeBaseDirectory>true</includeBaseDirectory>
<formats>
<format>tar.bz2</format>
</formats>
<fileSets>
<fileSet>
<includes>
<include>**/**jar-with-dependencies.jar</include>
</includes>
<outputDirectory>bin</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.basedir}/misc/shellScripts</directory>
<fileMode>0755</fileMode>
<lineEnding>lf</lineEnding>
<includes>
<include>*</include>
</includes>
<outputDirectory>bin</outputDirectory>
</fileSet>
</fileSets>
</assembly>
Of course, the assembly descriptor must located in the place declared:
This, you can build packages like this: ProjectXYZ/target/ProjectXYZ-1.0-SNAPSHOT-20110714-221041-dist.tar.bz2
mvn package
The jar would be called like this:
java -jar ProjectXYZ-1.0-SNAPSHOT-jar-with-dependencies.jar
What a ugly name, maybe I need a installer or a shell script as a wrapper:
#!/bin/bash
java -Xms300M -Xmx300M -jar $PROJECTXYZ_HOME/ProjectXYZ-1.0-SNAPSHOT-jar-with-dependencies.jar $*
java -Xms300M -Xmx300M -jar $PROJECTXYZ_HOME/ProjectXYZ-1.0-SNAPSHOT-jar-with-dependencies.jar $*
Ok, I need a installer.
Labels:
assembly,
bzip2,
jar-with-dependencies,
maven,
timestamp
2011/06/08
ECJ mavenized!
ECJ v20 has finally been mavenized and now lives in the Maven's central repository, enjoy!
<dependency>
<groupId>edu.gmu.cs</groupId>
<artifactId>ecj</artifactId>
<version>20.0</version>
<type>jar</type>
</dependency>
The project is hosted by The Open Source Project Repository Hosting at Sonatype.
<dependency>
<groupId>edu.gmu.cs</groupId>
<artifactId>ecj</artifactId>
<version>20.0</version>
<type>jar</type>
</dependency>
The project is hosted by The Open Source Project Repository Hosting at Sonatype.
2011/03/24
Using an unofficial maven Weka repository
Today I needed to use Weka for a scholar project plus Maven but because it doesn't exist in the official maven repositories I just added it using a third party repository.
pom.xml:
...
<repositories>
<repository>
<id>weka</id>
<name>Weka unofficial repository</name>
<layout>default</layout>
<url>http://maven.ch.cam.ac.uk/m2repo/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
...
<dependencies>
...
<dependency>
<groupId>weka</groupId>
<artifactId>weka</artifactId>
<version>3.5.7</version>
<type>jar</type>
</dependency>
...
<dependencies>
...
What a wonderful tool maven is!
pom.xml:
...
<repositories>
<repository>
<id>weka</id>
<name>Weka unofficial repository</name>
<layout>default</layout>
<url>http://maven.ch.cam.ac.uk/m2repo/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
...
<dependencies>
...
<dependency>
<groupId>weka</groupId>
<artifactId>weka</artifactId>
<version>3.5.7</version>
<type>jar</type>
</dependency>
...
<dependencies>
...
What a wonderful tool maven is!
Subscribe to:
Posts (Atom)