cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Huss <johnth...@gmail.com>
Subject Re: How to use cayenne-migrations
Date Mon, 24 Mar 2014 14:11:58 GMT
I usually run MigrationGenerator from eclipse.  You can just create a new
"Java Application" launch configuration for the project and enter
"org.apache.cayenne.migration.MigrationGenerator" as the main class.  And
then on the arguments tab enter your cayenne project filename and the
output directory.  For example "cayenne-MyDomain.xml ."  (dot for the
current directory).


On Mon, Mar 24, 2014 at 12:22 AM, D Tim Cummings <tim@triptera.com.au>wrote:

> It looks like the problem was me having a project called
> cayenne-migrations in my workspace directory. When I moved it out, the
> classpath issues were resolved. Solved the cayenne-di problem as well.
>
> So to summarise my procedure to generate initial migration for the benefit
> of others.
>
> 1. Checked out cayenne-migrations and installed in local mvn repository
>
> svn co http://svn.apache.org/repos/asf/cayenne/sandbox/cayenne-migrations/
> cd cayenne-migrations/
> mvn clean install
> cd ..
>
>
> 2. create an empty tapestry 5.3.7 project called tapgen and an output
> folder to collect the generated class file
>
> mvn archetype:generate -DarchetypeCatalog=http://tapestry.apache.org
> # I used all defaults apart from archetype=Tapestry 5 Quickstart Project,
> groupId mygroup, artifactId tapgen
> cd tapgen
> mkdir output
>
> 3. Add the following dependencies to pom.xml in tapgen
>
>         <dependency>
>         <groupId>org.apache.cayenne</groupId>
>         <artifactId>cayenne-server</artifactId>
>         <version>3.2M1</version>
>         </dependency>
>         <dependency>
>         <groupId>org.apache.cayenne</groupId>
>         <artifactId>cayenne-migrations</artifactId>
>         <version>0.1</version>
>         </dependency>
>
>
> 4. Copy my cayenne-project.xml and datamap.map.xml files into
> tapgen/src/main/resources/
>
> 5. Add code to src/main/java/mygroup/services/AppModule.java to do the
> generation at startup
>
>     @org.apache.tapestry5.ioc.annotations.Startup
>     public void doGenerate() {
>       org.apache.cayenne.migration.MigrationGenerator gen = new
> org.apache.cayenne.migration.MigrationGenerator();
>       gen.generateInitialMigration("cayenne-project.xml", "output");
>     }
>
> 6. Run the tapestry app and file will be output to
> tapgen/output/Datamap0.java
>
> mvn jetty:run
>
> # ^C to stop when logs show generation complete
>
>
> I hope this is helpful to someone. :)
>
> Tim
>
> On 24 Mar 2014, at 14:06, D Tim Cummings <tim@triptera.com.au> wrote:
>
> I worked out what the folder not a jar is. It is because I had
> cayenne-migrations open as a project in eclipse.
>
> However cayenne-migrations is still not on the classpath. I have compile
> errors in my code. When I do
>
> mvn eclipse:clean
> mvn eclipse:eclipse -DdownloadSources=true
> cat .classpath | grep cayenne
>
> All I get is
>
>   <classpathentry kind="var"
> path="M2_REPO/org/apache/cayenne/cayenne-server/3.2M1/cayenne-server-3.2M1.jar"
> sourcepath="M2_REPO/org/apache/cayenne/cayenne-server/3.2M1/cayenne-server-3.2M1-sources.jar"/>
>   <classpathentry kind="src" path="/cayenne-di"/>
>
> I think the cayenne-di is a mistake. In eclipse I get a build error saying
> project cayenne-di can not be found. I remove the project from the build
> path and error goes away.
>
> I would expect to see another line like the first for cayenne-migrations.
>
> Tim
>
>
>
>
> On 24 Mar 2014, at 11:12, D Tim Cummings <tim@triptera.com.au> wrote:
>
>
> Another thing I find unusual is that when I add a maven dependency of
> cayenne-migrations to my tapestry app using the following
>
>         <dependency>
>         <groupId>org.apache.cayenne</groupId>
>         <artifactId>cayenne-server</artifactId>
>         <version>3.2M1</version>
>         </dependency>
>         <dependency>
>         <groupId>org.apache.cayenne</groupId>
>         <artifactId>cayenne-migrations</artifactId>
>         <version>0.1</version>
>         </dependency>
>
>
> then cayenne-migrations shows up as a folder not a jar in the dependency
> view of the pom, and it does not appear to be on the classpath.
>
> <Screen Shot 2014-03-24 at 10.57.35.png>
>
> I don't know what this means?
>
> Thanks
>
> Tim
>
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message