tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1333926 - in /tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run: AbstractRunMojo.java RunMojo.java
Date Fri, 04 May 2012 13:05:53 GMT
Author: olamy
Date: Fri May  4 13:05:53 2012
New Revision: 1333926

URL: http://svn.apache.org/viewvc?rev=1333926&view=rev
Log:
[MTOMCAT-150] expose ports used with tomcat7:run as sys props

Modified:
    tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java
    tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/RunMojo.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=1333926&r1=1333925&r2=1333926&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:05:53 2012
@@ -372,6 +372,13 @@ public abstract class AbstractRunMojo
      */
     protected String classLoaderClass;
 
+    /**
+     * @parameter default-value="${session}"
+     * @readonly
+     * @required
+     */
+    protected MavenSession session;
+
     // ----------------------------------------------------------------------
     // Fields
     // ----------------------------------------------------------------------
@@ -863,7 +870,6 @@ public abstract class AbstractRunMojo
 
                 embeddedTomcat.setDefaultRealm( memoryRealm );
 
-
                 Context ctx = createContext( embeddedTomcat );
 
                 if ( useNaming )
@@ -871,7 +877,6 @@ public abstract class AbstractRunMojo
                     embeddedTomcat.enableNaming();
                 }
 
-
                 embeddedTomcat.getHost().setAppBase( new File( configurationDir, "webapps"
).getAbsolutePath() );
 
                 createStaticContext( embeddedTomcat, ctx, embeddedTomcat.getHost() );
@@ -896,9 +901,10 @@ public abstract class AbstractRunMojo
                 embeddedTomcat.getHost().getPipeline().addValve( alv );
 
                 // create https connector
+                Connector httpsConnector = null;
                 if ( httpsPort > 0 )
                 {
-                    Connector httpsConnector = new Connector( protocol );
+                    httpsConnector = new Connector( protocol );
                     httpsConnector.setPort( httpsPort );
                     httpsConnector.setSecure( true );
                     httpsConnector.setProperty( "SSLEnabled", "true" );
@@ -921,9 +927,10 @@ public abstract class AbstractRunMojo
                 }
 
                 // create ajp connector
+                Connector ajpConnector = null;
                 if ( ajpPort > 0 )
                 {
-                    Connector ajpConnector = new Connector( ajpProtocol );
+                    ajpConnector = new Connector( ajpProtocol );
                     ajpConnector.setPort( ajpPort );
                     ajpConnector.setURIEncoding( uriEncoding );
                     embeddedTomcat.getEngine().getService().addConnector( ajpConnector );
@@ -941,6 +948,25 @@ public abstract class AbstractRunMojo
                 }
 
                 embeddedTomcat.start();
+
+                session.getExecutionProperties().put( "tomcat.maven.http.port",
+                                                      Integer.toString( connector.getLocalPort()
) );
+                System.setProperty( "tomcat.maven.http.port", Integer.toString( connector.getLocalPort()
) );
+
+                if ( httpsConnector != null )
+                {
+                    session.getExecutionProperties().put( "tomcat.maven.https.port",
+                                                          Integer.toString( httpsConnector.getLocalPort()
) );
+                    System.setProperty( "tomcat.maven.https.port", Integer.toString( httpsConnector.getLocalPort()
) );
+                }
+
+                if ( ajpConnector != null )
+                {
+                    session.getExecutionProperties().put( "tomcat.maven.ajp.port",
+                                                          Integer.toString( ajpConnector.getLocalPort()
) );
+                    System.setProperty( "tomcat.maven.ajp.port", Integer.toString( ajpConnector.getLocalPort()
) );
+                }
+
                 EmbeddedRegistry.getInstance().register( embeddedTomcat );
 
             }

Modified: tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/RunMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/RunMojo.java?rev=1333926&r1=1333925&r2=1333926&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/RunMojo.java
(original)
+++ tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/RunMojo.java
Fri May  4 13:05:53 2012
@@ -137,13 +137,6 @@ public class RunMojo
     private MavenFileFilter mavenFileFilter;
 
     /**
-     * @parameter default-value="${session}"
-     * @readonly
-     * @required
-     */
-    protected MavenSession session;
-
-    /**
      * {@inheritDoc}
      */
     @Override



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message