2012/5/25 Konstantin Kolinko <knst.koli...@gmail.com>: > 2012/5/4 <ol...@apache.org>: >> Author: olamy >> Date: Fri May 4 13:06:23 2012 >> New Revision: 1333929 >> >> URL: http://svn.apache.org/viewvc?rev=1333929&view=rev >> Log: >> [MTOMCAT-150] expose ports used with tomcat7:run as sys props: feature to >> dump ports in a property file to be able to use later with a forked surefire >> execution >> >> Modified: >> >> tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java >> >> Modified: >> tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java >> URL: >> http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java?rev=1333929&r1=1333928&r2=1333929&view=diff >> ============================================================================== >> --- >> tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java >> (original) >> +++ >> tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java >> Fri May 4 13:06:23 2012 >> @@ -31,6 +31,7 @@ import org.apache.catalina.startup.Catal >> import org.apache.catalina.startup.CatalinaProperties; >> import org.apache.catalina.startup.Tomcat; >> import org.apache.catalina.valves.AccessLogValve; >> +import org.apache.commons.io.IOUtils; >> import org.apache.commons.lang.StringUtils; >> import org.apache.maven.artifact.Artifact; >> import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; >> @@ -69,6 +70,7 @@ import javax.xml.stream.XMLStreamReader; >> import java.io.File; >> import java.io.FileInputStream; >> import java.io.FileNotFoundException; >> +import java.io.FileOutputStream; >> import java.io.IOException; >> import java.net.MalformedURLException; >> import java.net.URL; >> @@ -78,6 +80,7 @@ import java.util.Collections; >> import java.util.Iterator; >> import java.util.List; >> import java.util.Map; >> +import java.util.Properties; >> import java.util.Set; >> >> /** >> @@ -382,6 +385,14 @@ public abstract class AbstractRunMojo >> */ >> protected MavenSession session; >> >> + /** >> + * Will dump port in a properties file (see ports for property names). >> + * If empty no file generated >> + * >> + * @parameter expression="${maven.tomcat.propertiesPortFilePath}" >> + */ >> + protected String propertiesPortFilePath; >> + >> // ---------------------------------------------------------------------- >> // Fields >> // ---------------------------------------------------------------------- >> @@ -952,6 +963,10 @@ public abstract class AbstractRunMojo >> >> embeddedTomcat.start(); >> >> + Properties portProperties = new Properties(); >> + >> + portProperties.put( "tomcat.maven.http.port", >> Integer.toString( connector.getLocalPort() ) ); >> + >> session.getExecutionProperties().put( >> "tomcat.maven.http.port", >> Integer.toString( >> connector.getLocalPort() ) ); >> System.setProperty( "tomcat.maven.http.port", >> Integer.toString( connector.getLocalPort() ) ); >> @@ -960,6 +975,7 @@ public abstract class AbstractRunMojo >> { >> session.getExecutionProperties().put( >> "tomcat.maven.https.port", >> Integer.toString( >> httpsConnector.getLocalPort() ) ); >> + portProperties.put( "tomcat.maven.https.port", >> Integer.toString( connector.getLocalPort() ) ); > > > The above line apparently should have called > httpsConnector.getLocalPort() Good catch ! Thanks! > >> System.setProperty( "tomcat.maven.https.port", >> Integer.toString( httpsConnector.getLocalPort() ) ); >> } >> >> (...) > > Best regards, > Konstantin Kolinko > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org >
-- Olivier Lamy Talend: http://coders.talend.com http://twitter.com/olamy | http://linkedin.com/in/olamy --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org