You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Andrus Adamchik <an...@objectstyle.org> on 2009/12/04 10:13:13 UTC

Tutorials

I think I am giving up on an idea of a Maven-free tutorial. It will be  
just too hard for us to maintain... In return for introducing Maven to  
the "Getting Started" tutorials we'll get a these benefits:

* Maven-based web container start (I am at a loss which webapp Eclipse  
plugin to recommend to users these days... They either suck or  
unsupported and out of date... I am personally using a Jetty launcher  
with main class that I wrote).

* Declarative dependency management (instead of "download Derby from  
here", we just tell them to place it in the pom).

* Tutorials code can be built together with Cayenne core, so they  
never become invalid (and there's a better chance they will be  
maintained), and also can be easily bundled with a release.


The downsides are:

* Some people just won't bother using Maven

* Since dependency management is transparent, we don't show how to  
include dependent jars in the project.

I guess Maven wins...

Andrus

RE: Tutorials

Posted by Рябицкий Евгений <er...@diasoft.ru>.

> * Tutorials code can be built together with Cayenne core, so they  
> never become invalid (and there's a better chance they will be  
> maintained), and also can be easily bundled with a release.

Some note from my experience.
Best way is to add tutorials build and any docs build as a profile in Maven (turned off by default). And turn on this profile at Hudson. Also turn it while release. If someone changing docs he should turn it.
But nobody else want to build docs every time.

Evgeny.

Re: Tutorials

Posted by Andrus Adamchik <an...@objectstyle.org>.
Yeah, I am using pretty much the same thing locally. Good idea t check  
whether embedded Jetty is usable as a web container. (I thought  
Eclipse uses it for something other than web apps execution?)

Andrus

On Dec 4, 2009, at 5:48 PM, Mike Kienenberger wrote:

> For an Eclipse WebContainer, I use an external jetty install (although
> I think Jetty 7 now ships with Eclipse), a jetty-xml config file, and
> a file-based (Run Config -> Common -> Save as local file) run
> configuration specifying the main class and any other configuration.
> Turned out to be a lot easier than trying to keep up with
> JettyLauncher, and gave me more options.   I can check both
> configurations into the project, and by defining a jetty user library
> (pointing to the jetty install libs), all of the other team members
> can use it.   They grab the jetty version of their choice, add it to
> to their user lib, and it all just works.
>
> For eclipse-based tutorials, this would all be straight-forward except
> for the external jetty install, but if newer versions of eclipse ship
> with jetty bundled, then that problem goes away.
>
> It's generally useful info, so I sanitized my config files and
> attached them to the message as well as included them inline as text.
>
> =====================Jetty projectname.launch ====================
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <launchConfiguration  
> type="org.eclipse.jdt.launching.localJavaApplication">
> <stringAttribute key="bad_container_name"
> value="jetty-run-configuration.eclipse"/>
> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
> <listEntry value="/projectName"/>
> </listAttribute>
> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
> <listEntry value="4"/>
> </listAttribute>
> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE"
> value="org.mortbay.start.Main"/>
> <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS"
> value="jetty-projectName.xml"/>
> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR"
> value="projectName"/>
> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS"
> value="-XX:MaxPermSize=256m
> -Djetty.keystore.home=${workspace_loc:projectName}
> -Djetty.webappRootDir=${workspace_loc:projectName}"/>
> </launchConfiguration>
>
> ===================== ^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
> ====================
>
> =====================Jetty projectname.xml ====================
>
> <?xml version="1.0"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
> "http://jetty.mortbay.org/configure.dtd">
> <Configure id="Server" class="org.mortbay.jetty.Server">
>    <Set name="ThreadPool">
>      <New class="org.mortbay.thread.BoundedThreadPool">
>        <Set name="minThreads">2</Set>
>        <Set name="lowThreads">2</Set>
>        <Set name="maxThreads">10</Set>
>      </New>
>    </Set>
>
> 	<Call name="addConnector">
> 	    <Arg>
> 	      <New class="org.mortbay.jetty.security.SslSocketConnector">
> 	        <Set name="Port">4443</Set>
> 	        <Set name="maxIdleTime">30000</Set>
> 	        <Set name="keystore"><SystemProperty
> name="jetty.keystore.home" default="." />/keystore-jetty</Set>
> 	        <Set name="password">password</Set>
> 	        <Set name="keyPassword">keyPassword</Set>
> 	        <Set name="truststore"><SystemProperty
> name="jetty.keystore.home" default="." />/keystore-jetty</Set>
> 	        <Set name="trustPassword">trustPassword</Set>
> 	      </New>
> 	    </Arg>
> 	  </Call>
>
>    <Call name="addConnector">
>      <Arg>
>          <New class="org.mortbay.jetty.bio.SocketConnector">
>            <Set name="port"><SystemProperty name="jetty.port"
> default="7777"/></Set>
>            <Set name="maxIdleTime">30000</Set>
>            <Set name="Acceptors">2</Set>
>            <Set name="confidentialPort">4443</Set>
>          </New>
>      </Arg>
>    </Call>
>    <Set name="handler">
>      <New id="handlers"  
> class="org.mortbay.jetty.handler.HandlerCollection">
>        <Set name="handlers">
>         <Array type="org.mortbay.jetty.Handler">
>           <Item>
>             <New id="contexts"
> class="org.mortbay.jetty.handler.ContextHandlerCollection"/>
>           </Item>
>           <Item>
>             <New id="defaultHandler"
> class="org.mortbay.jetty.handler.DefaultHandler"/>
>           </Item>
>           <Item>
>             <New id="requestLog"
> class="org.mortbay.jetty.handler.RequestLogHandler"/>
>           </Item>
>         </Array>
>        </Set>
>      </New>
>    </Set>
>    <New id="projectName"  
> class="org.mortbay.jetty.webapp.WebAppContext">
>      <Arg><Ref id="contexts"/></Arg>
>      <Arg><SystemProperty name="jetty.webappRootDir" default="." /></ 
> Arg>
>      <Arg>/projectName</Arg>
>    </New>
>
>    <!-- ===========================================================  
> -->
>    <!-- extra options                                                
> -->
>    <!-- ===========================================================  
> -->
>    <Set name="stopAtShutdown">true</Set>
>    <!-- ensure/prevent Server: header being sent to browsers         
> -->
>    <Set name="sendServerVersion">true</Set>
>
> 	
> <!-- JNDI data source
>
>  <Call name="addService">
>    <Arg>
>      <New class="org.mortbay.jetty.plus.JotmService">
>        <Call name="addDataSource">
>             <Arg>jdbc/db1</Arg>
>             <Arg>
> 			   <New class="org.apache.commons.dbcp.BasicDataSource">
>                 <Set  
> name="DriverName">oracle.jdbc.driver.OracleDriver</Set>
>                 <Set name="Url">jdbc:oracle:thin:@yourhost: 
> 1521:yourdb</Set>
>                 <Set name="User">db1</Set>
>                 <Set name="Password">passwd</Set>
> 				</New>
>             </Arg>
>        </Call>
>     </New>
>   </Arg>
>  </Call>
>
> -->
> 	
> </Configure>
> ===================== ^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
> ====================
>
>
> On Fri, Dec 4, 2009 at 4:13 AM, Andrus Adamchik <andrus@objectstyle.org 
> > wrote:
>> I think I am giving up on an idea of a Maven-free tutorial. It will  
>> be just
>> too hard for us to maintain... In return for introducing Maven to the
>> "Getting Started" tutorials we'll get a these benefits:
>>
>> * Maven-based web container start (I am at a loss which webapp  
>> Eclipse
>> plugin to recommend to users these days... They either suck or  
>> unsupported
>> and out of date... I am personally using a Jetty launcher with main  
>> class
>> that I wrote).
>>
>> * Declarative dependency management (instead of "download Derby  
>> from here",
>> we just tell them to place it in the pom).
>>
>> * Tutorials code can be built together with Cayenne core, so they  
>> never
>> become invalid (and there's a better chance they will be  
>> maintained), and
>> also can be easily bundled with a release.
>>
>>
>> The downsides are:
>>
>> * Some people just won't bother using Maven
>>
>> * Since dependency management is transparent, we don't show how to  
>> include
>> dependent jars in the project.
>>
>> I guess Maven wins...
>>
>> Andrus
>>
> <jetty-projectName.xml>


Re: Tutorials

Posted by Mike Kienenberger <mk...@gmail.com>.
For an Eclipse WebContainer, I use an external jetty install (although
I think Jetty 7 now ships with Eclipse), a jetty-xml config file, and
a file-based (Run Config -> Common -> Save as local file) run
configuration specifying the main class and any other configuration.
Turned out to be a lot easier than trying to keep up with
JettyLauncher, and gave me more options.   I can check both
configurations into the project, and by defining a jetty user library
(pointing to the jetty install libs), all of the other team members
can use it.   They grab the jetty version of their choice, add it to
to their user lib, and it all just works.

For eclipse-based tutorials, this would all be straight-forward except
for the external jetty install, but if newer versions of eclipse ship
with jetty bundled, then that problem goes away.

It's generally useful info, so I sanitized my config files and
attached them to the message as well as included them inline as text.

=====================Jetty projectname.launch ====================

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<stringAttribute key="bad_container_name"
value="jetty-run-configuration.eclipse"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/projectName"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE"
value="org.mortbay.start.Main"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS"
value="jetty-projectName.xml"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR"
value="projectName"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS"
value="-XX:MaxPermSize=256m
-Djetty.keystore.home=${workspace_loc:projectName}
-Djetty.webappRootDir=${workspace_loc:projectName}"/>
</launchConfiguration>

===================== ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ====================

=====================Jetty projectname.xml ====================

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://jetty.mortbay.org/configure.dtd">
<Configure id="Server" class="org.mortbay.jetty.Server">
    <Set name="ThreadPool">
      <New class="org.mortbay.thread.BoundedThreadPool">
        <Set name="minThreads">2</Set>
        <Set name="lowThreads">2</Set>
        <Set name="maxThreads">10</Set>
      </New>
    </Set>

	<Call name="addConnector">
	    <Arg>
	      <New class="org.mortbay.jetty.security.SslSocketConnector">
	        <Set name="Port">4443</Set>
	        <Set name="maxIdleTime">30000</Set>
	        <Set name="keystore"><SystemProperty
name="jetty.keystore.home" default="." />/keystore-jetty</Set>
	        <Set name="password">password</Set>
	        <Set name="keyPassword">keyPassword</Set>
	        <Set name="truststore"><SystemProperty
name="jetty.keystore.home" default="." />/keystore-jetty</Set>
	        <Set name="trustPassword">trustPassword</Set>
	      </New>
	    </Arg>
	  </Call>

    <Call name="addConnector">
      <Arg>
          <New class="org.mortbay.jetty.bio.SocketConnector">
            <Set name="port"><SystemProperty name="jetty.port"
default="7777"/></Set>
            <Set name="maxIdleTime">30000</Set>
            <Set name="Acceptors">2</Set>
            <Set name="confidentialPort">4443</Set>
          </New>
      </Arg>
    </Call>
    <Set name="handler">
      <New id="handlers" class="org.mortbay.jetty.handler.HandlerCollection">
        <Set name="handlers">
         <Array type="org.mortbay.jetty.Handler">
           <Item>
             <New id="contexts"
class="org.mortbay.jetty.handler.ContextHandlerCollection"/>
           </Item>
           <Item>
             <New id="defaultHandler"
class="org.mortbay.jetty.handler.DefaultHandler"/>
           </Item>
           <Item>
             <New id="requestLog"
class="org.mortbay.jetty.handler.RequestLogHandler"/>
           </Item>
         </Array>
        </Set>
      </New>
    </Set>
    <New id="projectName" class="org.mortbay.jetty.webapp.WebAppContext">
      <Arg><Ref id="contexts"/></Arg>
      <Arg><SystemProperty name="jetty.webappRootDir" default="." /></Arg>
      <Arg>/projectName</Arg>
    </New>

    <!-- =========================================================== -->
    <!-- extra options                                               -->
    <!-- =========================================================== -->
    <Set name="stopAtShutdown">true</Set>
    <!-- ensure/prevent Server: header being sent to browsers        -->
    <Set name="sendServerVersion">true</Set>

	
<!-- JNDI data source

  <Call name="addService">
    <Arg>
      <New class="org.mortbay.jetty.plus.JotmService">
        <Call name="addDataSource">
             <Arg>jdbc/db1</Arg>
             <Arg>
			   <New class="org.apache.commons.dbcp.BasicDataSource">
                 <Set name="DriverName">oracle.jdbc.driver.OracleDriver</Set>
                 <Set name="Url">jdbc:oracle:thin:@yourhost:1521:yourdb</Set>
                 <Set name="User">db1</Set>
                 <Set name="Password">passwd</Set>
				</New>
             </Arg>
        </Call>
     </New>
   </Arg>
  </Call>

-->
	
</Configure>
===================== ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ====================


On Fri, Dec 4, 2009 at 4:13 AM, Andrus Adamchik <an...@objectstyle.org> wrote:
> I think I am giving up on an idea of a Maven-free tutorial. It will be just
> too hard for us to maintain... In return for introducing Maven to the
> "Getting Started" tutorials we'll get a these benefits:
>
> * Maven-based web container start (I am at a loss which webapp Eclipse
> plugin to recommend to users these days... They either suck or unsupported
> and out of date... I am personally using a Jetty launcher with main class
> that I wrote).
>
> * Declarative dependency management (instead of "download Derby from here",
> we just tell them to place it in the pom).
>
> * Tutorials code can be built together with Cayenne core, so they never
> become invalid (and there's a better chance they will be maintained), and
> also can be easily bundled with a release.
>
>
> The downsides are:
>
> * Some people just won't bother using Maven
>
> * Since dependency management is transparent, we don't show how to include
> dependent jars in the project.
>
> I guess Maven wins...
>
> Andrus
>