This is, hopefully, well documented.
Jeff Butler
On Fri, Dec 2, 2011 at 9:41 AM, Yoel Benharrous
Actually, I was just trying to make the java merge functionality
available in non-Eclipse environment.The AST parser used in generator
eclipse plugin can be used outside Eclipse with appropriate
dependencies added.
I just did a few simple test, but it seems to be working.
Here's what I did:
1. Build modified version of generator binary.
1-1. Copy merge-related files from generator eclipse plugin project.
You will need the three files in the following directory.
http://mybatis.googlecode.com/svn/sub-projects/generator/trunk/eclipse/org.mybatis.generator.eclipse.core/src/org/mybatis/generator/eclipse/core/merge/
1-2. Edit the DefaultShellCallback as follows
* change #isMergeSupported() to return true.
* change #mergeJavaFile() method: instead of throwing
UnsupportedOperationException, add the following lines (copied from
EclipseShellCallback.java). JavaFileMerger merger = new
JavaFileMerger(newFileSource, existingFileFullPath, javadocTags,
fileEncoding); return merger.getMergedSource();
1-3. Add the following dependency to the pom.xml (other dependencies
seems to be automatically loaded).<dependency>
<groupId>org.eclipse.jdt</groupId> <artifactId>core</artifactId>
<version>3.3.0-v_771</version></dependency>
1-4. Build generator jar with 'mvn clean package'.
2. Run generator with dependencies. I executed the following command.
You will find the eclipse-related jars somewhere under the
$M2_REPO/org/eclipse/ directory.
java -cp mybatis-generator-core-1.3.2-SNAPSHOT.jar:core-3.3.0-v_771.jar:text-3.3.0-v20070606-0010.jar:runtime-3.3.100-v20070530.jar:common-3.3.0-v20070426.jar:osgi-3.3.0-v20070530.jar:resources-3.3.0-v20070604.jar:jobs-3.3.0-v20070423.jar:contenttype-3.2.100-v20070319.jar:preferences-3.2.100-v20070522.jar
org.mybatis.generator.api.ShellRunner -configfile GeneratorConfig.xml
As I am a happy Eclipse user myself, it would be great if you test
these steps and give us a feedback.
Regards,Iwao
2011/12/2 Jeff Butler <jeffg...@gmail.com>:
1. Build modified version of generator binary.
1-1. Copy merge-related files from generator eclipse plugin project.
You will need the three files in the following directory.
http://mybatis.googlecode.com/svn/sub-projects/generator/trunk/eclipse/org.mybatis.generator.eclipse.core/src/org/mybatis/generator/eclipse/core/merge/
1-2. Edit the DefaultShellCallback as follows
* change #isMergeSupported() to return true.
* change #mergeJavaFile() method: instead of throwing
UnsupportedOperationException, add the following lines (copied from
EclipseShellCallback.java). JavaFileMerger merger = new
JavaFileMerger(newFileSource, existingFileFullPath, javadocTags,
fileEncoding); return merger.getMergedSource();
1-3. Add the following dependency to the pom.xml (other dependencies
seems to be automatically loaded).
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>core</artifactId>
<version>3.3.0-v_771</version>
</dependency>
1-4. Build generator jar with 'mvn clean package'.
2. Run generator with dependencies. I executed the following command.
You will find these jars somewhere under the $M2_REPO/org/eclipse/
Jeff Butler
2011/12/3 Jeff Butler <jeffg...@gmail.com>:
> That is super cool. My only concern about doing this in the committed
> code is that the versions of Eclipse in maven are over 4 years old.
Yes, it's a shame.
I am looking for some information as someone must have asked or
requested it before.
> Do you happen to know if Eclipse has any formal statement about
> putting their artifacts in Maven?
I think EPL permits it, but it needs to be clarified.
I'll search about it too, but if anyone on this list knows about the
stuff, please share it with us.
Regards,
Iwao
and in the associated bugzilla tickets. It seems that Eclipse has
been working on doing a Maven push of their artifacts for a couple
years. The technical issues seem to be related to converting their
OSGi based component structure into something that is Maven compliant.
Once they have this working it will make it possible for us to make
the Java code merge more widely available. That would be a good
thing!
Jeff Butler
Thanks for the link.
Let's hope they make it work soon!
And for those who are willing to try the steps I wrote, I found that
their testing repository contains newer version.
So in the step 1-3, add the following 'repositories' entry and the
dependency to the pom.xml.
<repositories>
<repository>
<id>eclipse-testing</id>
<name>Eclipse Testing Repository</name>
<url>http://maven.eclipse.org/nexus/content/repositories/testing/</url>
</repository>
</repositories>
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<version>3.6.2</version>
</dependency>
Regards,
Iwao
2011/12/3 Jeff Butler <jeffg...@gmail.com>: