maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Pöllath <li...@poellath.org>
Subject Re: [m2] Using the jetty6 plugin was: Using the tomcat plugin
Date Tue, 22 Nov 2005 11:29:25 GMT
Hi Jan,

I tried the systemProperties approach (see my previous post), but no  
luck. Adding the implementation attribute (which isn't mentioned in  
the howto BTW) didn't help either.

My plugin repository points to http://www.mortbay.org/maven2/ 
snapshot, so I assume I'm using the latest snaphot.

Thanks,
-Ralph.

On 22.11.2005, at 11:47, Jan Bartel wrote:
> Hi Ralph,
>
> If you run the plugin with -X or -e then I think maven spits out the
> classpaths so you can see what is happening with the system classpath.
>
> An alternative is to use a feature I've just added to the plugin,  
> which
> is the ability to define name/value pairs that the plugin will set as
> system properties. You could define the "log4j.configuration" property
> to point to where your config file is.
> Add these lines to the plugin's configuration:
>
>                <systemProperties>
>                  <systemProperty  
> implementation="org.mortbay.jetty.plugin.SystemProperty">
>                    <name>log4j.configuration</name>
>                    <value>${basedir}/src/jetty/resources/ 
> log4j.properties</value>
>                  </systemProperty>
>               </systemProperties>
>
> You will need to use the latest snapshot version of the plugin to  
> be able to use this feature. More instructions are at
>
> http://jetty.mortbay.org/jetty6/maven-plugin/howto.html
>
>
> regards
> Jan
>
>
> Ralph Pöllath wrote:
>> Hi,
>> The one thing that keeps me from using the jetty6 plugin instead  
>> of  tomcat for development is the log4j configuration for my  
>> spring  application.
>> As usual, the application expects log4j config in   
>> classpath:log4j.properties. For use with jetty, I need a  
>> different  config file to be available at that location (log to  
>> console instead  of files), so I dropped this into my POM:
>> <profiles>
>>     <profile>
>>         <id>jetty</id>
>>         <pluginRepositories ... />
>>         <build>
>>             <resources>
>>                 <resource>
>>                     <!-- include config for use with jetty -->
>>                     <directory>src/jetty/resources</directory>
>>                     <includes>
>>                         <include>log4j.properties</include>
>>                     </includes>
>>                 </resource>
>>                 <resource>
>>                     <!-- exclude regulat config for use with  
>> tomcat -->
>>                     <directory>src/main/resources</directory>
>>                     <excludes>
>>                         <exclude>log4j.properties</exclude>
>>                     </excludes>
>>                 </resource>
>>             </resources>
>>             <pluginManagement ... />
>>         </build>
>>         <dependencies ... oracle ... />
>>     </profile>
>> </profiles>
>> The exclude stuff seems to work, but src/jetty/resources/  
>> log4j.properties doesn't seem to be placed on the classpath:
>> Embedded error: Invalid 'log4jConfigLocation' parameter: class  
>> path  resource [log4j.properties] cannot be resolved to URL  
>> because it does  not exist
>> Jetty says
>> [INFO] Setting up classpath ...
>> :INFO:  Checking Resource aliases
>> [INFO] Finished setting up classpath
>> Is it possible to somehow display the classpath for inspection?
>> I thought of filtering web.xml to manipulate the expected  
>> filename,  but I guess that won't work since the webapp directory  
>> is src/main/ webapp.
>> Thanks,
>> -Ralph.
>> On 03.11.2005, at 12:37, Jan Bartel wrote:
>>> Hi Ralph,
>>>
>>> I've linked the doco for the plugin onto the Jetty site. You can
>>> go directly to it here:
>>> http://jetty.mortbay.org/jetty6/maven-plugin/index.html
>>>
>>> You can change where the plugin expects to find your webapp by
>>> configuring the webAppSourceDirectory property.
>>>
>>> Regarding the oracle jars, I'm not sure about this, but perhaps  
>>> you  could use the <dependencies> associated with the <plugin>
>>> tag to get them onto the runtime classpath?
>>>
>>> cheers
>>> Jan
>>>
>>>
>>> Ralph Pöllath wrote:
>>>
>>>> Hi,
>>>> I'm impressed! By following your instructions, I got jetty to  
>>>> run  my  webapp (using http://www.mortbay.org/maven2/snapshot  
>>>> as  mentioned by  Greg - the old url did not work anymore).
>>>> Unfortunately, I didn't get very far because jetty doesn't know   
>>>> about  my oracle drivers. With tomcat, I keep those in $  
>>>> {catalina.base}/ common/lib. I guess I could add them as   
>>>> dependencies tom my project  so they end up in WEB-INF/lib, but   
>>>> then I could not deploy the war to  tomcat anymore. Sounds like  
>>>> I  should have different maven profiles  fot these scenarios? Or  
>>>> does  jetty look for additional jars in some  location? That  
>>>> would make  it a lot easier..
>>>> I also noticed that jetty expects my webapp at ${dasedir}/src/  
>>>> main/ webapp. Running mvn war:inplace works, but feels rather   
>>>> clumsy. I  adds files to src that aren't sources, and I have to   
>>>> make sure I  don't accidentally add them to svn.
>>>> Cheers,
>>>> -Ralph.
>>>> On 02.11.2005, at 19:31, Jan Bartel wrote:
>>>>
>>>>> Ralph,
>>>>>
>>>>> Try putting the following in your pom.xml:
>>>>>
>>>>>  <pluginRepositories>
>>>>>    <pluginRepository>
>>>>>      <id>mortbay-repo</id>
>>>>>      <name>mortbay-repo</name>
>>>>>      <url>http://www.mortbay.org/maven2</url>
>>>>>    </pluginRepository>
>>>>>  </pluginRepositories>
>>>>>
>>>>> I should have the site doco for the plugin linked into the  
>>>>> Jetty   website in the next day. In the meanwhile, all you  
>>>>> should need  to  do is to add these plugin config
>>>>> lines to your pom.xml:
>>>>>
>>>>>      <plugin>
>>>>>        <groupId>org.mortbay.jetty</groupId>
>>>>>        <artifactId>maven-jetty6-plugin</artifactId>
>>>>>        <configuration>
>>>>>          <scanIntervalSeconds>20</scanIntervalSeconds>
>>>>>        </configuration>
>>>>>      </plugin>
>>>>>
>>>>> That will cause the plugin to keep running and scan for class/  
>>>>> lib  changes every 20secs. You
>>>>> can change it to whatever you prefer. There are also a couple  
>>>>> of   other config options, but
>>>>> that should get you going.
>>>>>
>>>>> You can run it:
>>>>>   mvn org.mortbay.jetty:maven-jetty6-plugin:1.0:run
>>>>>
>>>>> You can shorten that to:
>>>>>   mvn jetty6:run
>>>>>
>>>>> but I'm not sure exactly how to do that other than as the  
>>>>> plugin   developer (I followed the
>>>>> instructions at http://maven.apache.org/maven2/guides/plugin/  
>>>>> guide- java-plugin-development.html).
>>>>>
>>>>> Jason, is there any update on how we get the Jetty repository    
>>>>> mirrored to the central
>>>>> Maven2 repository?
>>>>>
>>>>>
>>>>> cheers
>>>>> Jan
>>>>>
>>>>> Ralph Pöllath wrote:
>>>>>
>>>>>> On 02.11.2005, at 16:55, Jan Bartel wrote:
>>>>>>
>>>>>>> Ralph,
>>>>>>>
>>>>>>> Just a suggestion: if you want to run your webapp without   
>>>>>>> having  to  create a war first,
>>>>>>> you could try the Jetty6 plugin. It is extremely lightweight,
 
>>>>>>> you
>>>>>>> don't have to have any external config files for it, plus  
>>>>>>> it   will  automatically
>>>>>>> hot-redeploy your webapp whenever you change any class files
  
>>>>>>> or   dependencies. You can
>>>>>>> get it from scpexe://jetty.mortbay.org/home/ftp/pub/maven2.
>>>>>>
>>>>>>
>>>>>> Hi,
>>>>>> sounds great, but I can't figure out what to do with  
>>>>>> scpexe://   jetty.mortbay.org/home/ftp/pub/maven2. I tried  
>>>>>> creating a    pluginRepository in ~/.m2/settings.xml but can't  
>>>>>> get it to work.
>>>>>> Cheers,
>>>>>> -Ralph.
>>>>>>
>>>>>>> Ralph Pöllath wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>> I've successfully compiled and installed the tomcat plugin
  
>>>>>>>> from   svn,  and tomcat:deploy works as expected. Now I'm
  
>>>>>>>> wondering  how  to best  use it.
>>>>>>>> For development, I'd like to avoid zipping up the war file
  
>>>>>>>> for   each  deployment. From gleaning at the source, I  
>>>>>>>> learned  this   means  deploying in local mode. I guess I
 
>>>>>>>> have to pass  a  parameter  to the  tomcat plugin, but I
 
>>>>>>>> can't figure out  the  parameter's  correct name (I  know,
 
>>>>>>>> this question is  related to  plugins in  general, but I
 
>>>>>>>> can't  find the  documentation).
>>>>>>>> I tried
>>>>>>>> $ mvn -Dorg.apache.maven.plugins.maven-tomcat-   
>>>>>>>> plugin.mode=local   tomcat:deploy
>>>>>>>> and
>>>>>>>> $ mvn -Dorg.codehaus.mojo.tomcat.mode=local tomcat:deploy
>>>>>>>> but all I get is
>>>>>>>> [INFO] Deploying war remotely to /myProject on http://  
>>>>>>>> localhost:  8080/ manager
>>>>>>>> which means I'm running in the default remote mode.
>>>>>>>> I also noticed there's a mode called inplace, that uses a
    
>>>>>>>> context.xml  file to deploy to tomcat, and requires the 

>>>>>>>> war   plugin  to run in  exploded mode. What's the advantage
 
>>>>>>>> of  using  inplace (I  assume you  get to use a path  
>>>>>>>> different  from   project.build.finalName?), and how  do
I  
>>>>>>>> configure the  war plugin?
>>>>>>>> How does everyone else use the tomcat plugin?
>>>>>>>> Thanks,
>>>>>>>> -Ralph.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message