You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Yang <te...@gmail.com> on 2011/05/25 23:54:20 UTC
avro-maven-plugin in eclipse?
it seems that eclipse can't run the generate-sources phase, so that I have to
do 'mvn generate-sources" outside of eclipse, and then import the
sources from eclipse.
is there a better way to integrate with eclipse?
Thanks
Yang
Re: avro-maven-plugin in eclipse?
Posted by James Baldassari <jb...@gmail.com>.
Just to follow up on this, I tried commenting out the <phase> and
<*Directory> settings, and everything still compiled correctly for me, so it
appears that the default settings are working correctly.
-James
On Wed, Jun 15, 2011 at 11:07 AM, James Baldassari <jb...@gmail.com>wrote:
> Glad you got it working. If the default values are not behaving as
> expected, we should file an issue. When I have a few minutes I'll try to
> reproduce your problem.
>
> -James
>
>
>
> On Tue, Jun 14, 2011 at 9:24 PM, Arun Ramakrishnan <
> sinchronized.arun@gmail.com> wrote:
>
>> Thanks James and Scott. Got it working. But, had to explicitly specify all
>> the paths just like in James's config example even though I am following the
>> default locations.
>>
>>
>> On Tue, Jun 14, 2011 at 12:32 PM, Scott Carey <sc...@richrelevance.com>wrote:
>>
>>>
>>> To configure the source and destination directories, it looks something
>>> like:
>>> <plugin>
>>> <groupId>org.apache.avro</groupId>
>>> <artifactId>avro-maven-plugin</artifactId>
>>> <version>1.5.1</version>
>>> <executions>
>>> <execution>
>>> <id>schemas</id>
>>> <phase>generate-sources</phase>
>>> <goals>
>>> <goal>schema</goal>
>>> </goals>
>>> <configuration>
>>> <sourceDirectory>src/main/schemata/avro</sourceDirectory>
>>>
>>> <outputDirectory>target/generated-sources/avro</outputDirectory>
>>> </configuration>
>>> </execution>
>>> </executions>
>>> </plugin>
>>>
>>> (which does only *.avsc via the schema goal)
>>>
>>> https://cwiki.apache.org/confluence/display/AVRO/Build+Documentation
>>>
>>> Covers the Avro build, and similar works for me in other projects.
>>>
>>> In particular, it seems as though one must do the "Maven > Update Project
>>> Configuration" step on a maven project to get it to add source directories
>>> generated by plugins.
>>>
>>> I usually do "Import …. Existing Maven Project" Followed immediately
>>> by "Maven > Update Project Configuration" on the project.
>>>
>>>
>>>
>>> On 6/14/11 11:46 AM, "Arun Ramakrishnan" <si...@gmail.com>
>>> wrote:
>>>
>>> From the command line
>>> "mvn avro:idl-protocol" finds my avdl files from src/main/avro and
>>> compiles it to the build directory.
>>>
>>> But, generate-sources ( command line or eclipse ) dosent seem to triger
>>> it. Am I missing something in the plugin configuration to integrate this
>>> into the generate-sources step.
>>> Also, what are the various config values ( if i want to change the
>>> default source, target directories etc ). I cant seem to find any docs on
>>> it.
>>>
>>>
>>> <plugin>
>>>
>>> <groupId>org.apache.avro</groupId>
>>>
>>> <artifactId>avro-maven-plugin</artifactId>
>>>
>>> <version>1.5.1</version>
>>>
>>> </plugin>
>>>
>>> I have the m2eclipse plugin too.
>>>
>>> On Wed, May 25, 2011 at 4:44 PM, Scott Carey <sc...@richrelevance.com>wrote:
>>>
>>>> generate-sources in Eclipse works for me. (Helios, m2Eclipse plugin).
>>>>
>>>> Sometimes, I have to right click on a project and select "Maven > Update
>>>> Project Configuration" to get it to generate the sources. It doesn't
>>>> automatically run generate-sources if you change a schema file, but a
>>>> project clean will trigger it for me.
>>>>
>>>>
>>>>
>>>> On 5/25/11 2:54 PM, "Yang" <te...@gmail.com> wrote:
>>>>
>>>> >it seems that eclipse can't run the generate-sources phase, so that I
>>>> >have to
>>>> >do 'mvn generate-sources" outside of eclipse, and then import the
>>>> >sources from eclipse.
>>>> >
>>>> >is there a better way to integrate with eclipse?
>>>> >
>>>> >Thanks
>>>> >Yang
>>>>
>>>>
>>>
>>
>
Re: avro-maven-plugin in eclipse?
Posted by James Baldassari <jb...@gmail.com>.
Glad you got it working. If the default values are not behaving as
expected, we should file an issue. When I have a few minutes I'll try to
reproduce your problem.
-James
On Tue, Jun 14, 2011 at 9:24 PM, Arun Ramakrishnan <
sinchronized.arun@gmail.com> wrote:
> Thanks James and Scott. Got it working. But, had to explicitly specify all
> the paths just like in James's config example even though I am following the
> default locations.
>
>
> On Tue, Jun 14, 2011 at 12:32 PM, Scott Carey <sc...@richrelevance.com>wrote:
>
>>
>> To configure the source and destination directories, it looks something
>> like:
>> <plugin>
>> <groupId>org.apache.avro</groupId>
>> <artifactId>avro-maven-plugin</artifactId>
>> <version>1.5.1</version>
>> <executions>
>> <execution>
>> <id>schemas</id>
>> <phase>generate-sources</phase>
>> <goals>
>> <goal>schema</goal>
>> </goals>
>> <configuration>
>> <sourceDirectory>src/main/schemata/avro</sourceDirectory>
>>
>> <outputDirectory>target/generated-sources/avro</outputDirectory>
>> </configuration>
>> </execution>
>> </executions>
>> </plugin>
>>
>> (which does only *.avsc via the schema goal)
>>
>> https://cwiki.apache.org/confluence/display/AVRO/Build+Documentation
>>
>> Covers the Avro build, and similar works for me in other projects.
>>
>> In particular, it seems as though one must do the "Maven > Update Project
>> Configuration" step on a maven project to get it to add source directories
>> generated by plugins.
>>
>> I usually do "Import …. Existing Maven Project" Followed immediately by
>> "Maven > Update Project Configuration" on the project.
>>
>>
>>
>> On 6/14/11 11:46 AM, "Arun Ramakrishnan" <si...@gmail.com>
>> wrote:
>>
>> From the command line
>> "mvn avro:idl-protocol" finds my avdl files from src/main/avro and
>> compiles it to the build directory.
>>
>> But, generate-sources ( command line or eclipse ) dosent seem to triger
>> it. Am I missing something in the plugin configuration to integrate this
>> into the generate-sources step.
>> Also, what are the various config values ( if i want to change the default
>> source, target directories etc ). I cant seem to find any docs on it.
>>
>>
>> <plugin>
>>
>> <groupId>org.apache.avro</groupId>
>>
>> <artifactId>avro-maven-plugin</artifactId>
>>
>> <version>1.5.1</version>
>>
>> </plugin>
>>
>> I have the m2eclipse plugin too.
>>
>> On Wed, May 25, 2011 at 4:44 PM, Scott Carey <sc...@richrelevance.com>wrote:
>>
>>> generate-sources in Eclipse works for me. (Helios, m2Eclipse plugin).
>>>
>>> Sometimes, I have to right click on a project and select "Maven > Update
>>> Project Configuration" to get it to generate the sources. It doesn't
>>> automatically run generate-sources if you change a schema file, but a
>>> project clean will trigger it for me.
>>>
>>>
>>>
>>> On 5/25/11 2:54 PM, "Yang" <te...@gmail.com> wrote:
>>>
>>> >it seems that eclipse can't run the generate-sources phase, so that I
>>> >have to
>>> >do 'mvn generate-sources" outside of eclipse, and then import the
>>> >sources from eclipse.
>>> >
>>> >is there a better way to integrate with eclipse?
>>> >
>>> >Thanks
>>> >Yang
>>>
>>>
>>
>
Re: avro-maven-plugin in eclipse?
Posted by Arun Ramakrishnan <si...@gmail.com>.
Thanks James and Scott. Got it working. But, had to explicitly specify all
the paths just like in James's config example even though I am following the
default locations.
On Tue, Jun 14, 2011 at 12:32 PM, Scott Carey <sc...@richrelevance.com>wrote:
>
> To configure the source and destination directories, it looks something
> like:
> <plugin>
> <groupId>org.apache.avro</groupId>
> <artifactId>avro-maven-plugin</artifactId>
> <version>1.5.1</version>
> <executions>
> <execution>
> <id>schemas</id>
> <phase>generate-sources</phase>
> <goals>
> <goal>schema</goal>
> </goals>
> <configuration>
> <sourceDirectory>src/main/schemata/avro</sourceDirectory>
>
> <outputDirectory>target/generated-sources/avro</outputDirectory>
> </configuration>
> </execution>
> </executions>
> </plugin>
>
> (which does only *.avsc via the schema goal)
>
> https://cwiki.apache.org/confluence/display/AVRO/Build+Documentation
>
> Covers the Avro build, and similar works for me in other projects.
>
> In particular, it seems as though one must do the "Maven > Update Project
> Configuration" step on a maven project to get it to add source directories
> generated by plugins.
>
> I usually do "Import …. Existing Maven Project" Followed immediately by
> "Maven > Update Project Configuration" on the project.
>
>
>
> On 6/14/11 11:46 AM, "Arun Ramakrishnan" <si...@gmail.com>
> wrote:
>
> From the command line
> "mvn avro:idl-protocol" finds my avdl files from src/main/avro and compiles
> it to the build directory.
>
> But, generate-sources ( command line or eclipse ) dosent seem to triger it.
> Am I missing something in the plugin configuration to integrate this into
> the generate-sources step.
> Also, what are the various config values ( if i want to change the default
> source, target directories etc ). I cant seem to find any docs on it.
>
>
> <plugin>
>
> <groupId>org.apache.avro</groupId>
>
> <artifactId>avro-maven-plugin</artifactId>
>
> <version>1.5.1</version>
>
> </plugin>
>
> I have the m2eclipse plugin too.
>
> On Wed, May 25, 2011 at 4:44 PM, Scott Carey <sc...@richrelevance.com>wrote:
>
>> generate-sources in Eclipse works for me. (Helios, m2Eclipse plugin).
>>
>> Sometimes, I have to right click on a project and select "Maven > Update
>> Project Configuration" to get it to generate the sources. It doesn't
>> automatically run generate-sources if you change a schema file, but a
>> project clean will trigger it for me.
>>
>>
>>
>> On 5/25/11 2:54 PM, "Yang" <te...@gmail.com> wrote:
>>
>> >it seems that eclipse can't run the generate-sources phase, so that I
>> >have to
>> >do 'mvn generate-sources" outside of eclipse, and then import the
>> >sources from eclipse.
>> >
>> >is there a better way to integrate with eclipse?
>> >
>> >Thanks
>> >Yang
>>
>>
>
Re: avro-maven-plugin in eclipse?
Posted by James Baldassari <jb...@gmail.com>.
HI Arun,
I think the default phase for the Avro Maven plugin is generate-sources, so
I'm surprised that doesn't work. You can always explicitly bind the plugin
to that phase. This is what I've been using to get my Avro
protocols/schemas compiled and added to the build path, both through the
command line and with the Eclipse plugin: http://pastebin.com/4WgjUW9Z
The Maven Eclipse plugin is buggy, especially when dealing with
generated/added sources. To get the plugin to execute the generate-sources
phase I usually have to right-click the project, go to the Maven sub-menu,
and then select Update Project Configuration. Sometimes that will result in
the generated sources getting added to the build path. If not, you might
have to manually add target/generated-sources/avro to the build path by
going through the project properties.
I'm also not aware of any documentation for the Avro Maven plugin (although
running maven:site on the source would probably generate it), but you can
always look at the plugin source to see what properties it's looking for:
http://svn.apache.org/repos/asf/avro/trunk/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/AbstractAvroMojo.java
-James
On Tue, Jun 14, 2011 at 2:46 PM, Arun Ramakrishnan <
sinchronized.arun@gmail.com> wrote:
> From the command line
> "mvn avro:idl-protocol" finds my avdl files from src/main/avro and compiles
> it to the build directory.
>
> But, generate-sources ( command line or eclipse ) dosent seem to triger it.
> Am I missing something in the plugin configuration to integrate this into
> the generate-sources step.
> Also, what are the various config values ( if i want to change the default
> source, target directories etc ). I cant seem to find any docs on it.
>
>
> <plugin>
>
> <groupId>org.apache.avro</groupId>
>
> <artifactId>avro-maven-plugin</artifactId>
>
> <version>1.5.1</version>
>
> </plugin>
>
> I have the m2eclipse plugin too.
>
> On Wed, May 25, 2011 at 4:44 PM, Scott Carey <sc...@richrelevance.com>wrote:
>
>> generate-sources in Eclipse works for me. (Helios, m2Eclipse plugin).
>>
>> Sometimes, I have to right click on a project and select "Maven > Update
>> Project Configuration" to get it to generate the sources. It doesn't
>> automatically run generate-sources if you change a schema file, but a
>> project clean will trigger it for me.
>>
>>
>>
>> On 5/25/11 2:54 PM, "Yang" <te...@gmail.com> wrote:
>>
>> >it seems that eclipse can't run the generate-sources phase, so that I
>> >have to
>> >do 'mvn generate-sources" outside of eclipse, and then import the
>> >sources from eclipse.
>> >
>> >is there a better way to integrate with eclipse?
>> >
>> >Thanks
>> >Yang
>>
>>
>
Re: avro-maven-plugin in eclipse?
Posted by Scott Carey <sc...@richrelevance.com>.
To configure the source and destination directories, it looks something like:
<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>1.5.1</version>
<executions>
<execution>
<id>schemas</id>
<phase>generate-sources</phase>
<goals>
<goal>schema</goal>
</goals>
<configuration>
<sourceDirectory>src/main/schemata/avro</sourceDirectory>
<outputDirectory>target/generated-sources/avro</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
(which does only *.avsc via the schema goal)
https://cwiki.apache.org/confluence/display/AVRO/Build+Documentation
Covers the Avro build, and similar works for me in other projects.
In particular, it seems as though one must do the "Maven > Update Project Configuration" step on a maven project to get it to add source directories generated by plugins.
I usually do "Import …. Existing Maven Project" Followed immediately by "Maven > Update Project Configuration" on the project.
On 6/14/11 11:46 AM, "Arun Ramakrishnan" <si...@gmail.com>> wrote:
>From the command line
"mvn avro:idl-protocol" finds my avdl files from src/main/avro and compiles it to the build directory.
But, generate-sources ( command line or eclipse ) dosent seem to triger it. Am I missing something in the plugin configuration to integrate this into the generate-sources step.
Also, what are the various config values ( if i want to change the default source, target directories etc ). I cant seem to find any docs on it.
<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>1.5.1</version>
</plugin>
I have the m2eclipse plugin too.
On Wed, May 25, 2011 at 4:44 PM, Scott Carey <sc...@richrelevance.com>> wrote:
generate-sources in Eclipse works for me. (Helios, m2Eclipse plugin).
Sometimes, I have to right click on a project and select "Maven > Update
Project Configuration" to get it to generate the sources. It doesn't
automatically run generate-sources if you change a schema file, but a
project clean will trigger it for me.
On 5/25/11 2:54 PM, "Yang" <te...@gmail.com>> wrote:
>it seems that eclipse can't run the generate-sources phase, so that I
>have to
>do 'mvn generate-sources" outside of eclipse, and then import the
>sources from eclipse.
>
>is there a better way to integrate with eclipse?
>
>Thanks
>Yang
Re: avro-maven-plugin in eclipse?
Posted by Arun Ramakrishnan <si...@gmail.com>.
>From the command line
"mvn avro:idl-protocol" finds my avdl files from src/main/avro and compiles
it to the build directory.
But, generate-sources ( command line or eclipse ) dosent seem to triger it.
Am I missing something in the plugin configuration to integrate this into
the generate-sources step.
Also, what are the various config values ( if i want to change the default
source, target directories etc ). I cant seem to find any docs on it.
<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>1.5.1</version>
</plugin>
I have the m2eclipse plugin too.
On Wed, May 25, 2011 at 4:44 PM, Scott Carey <sc...@richrelevance.com>wrote:
> generate-sources in Eclipse works for me. (Helios, m2Eclipse plugin).
>
> Sometimes, I have to right click on a project and select "Maven > Update
> Project Configuration" to get it to generate the sources. It doesn't
> automatically run generate-sources if you change a schema file, but a
> project clean will trigger it for me.
>
>
>
> On 5/25/11 2:54 PM, "Yang" <te...@gmail.com> wrote:
>
> >it seems that eclipse can't run the generate-sources phase, so that I
> >have to
> >do 'mvn generate-sources" outside of eclipse, and then import the
> >sources from eclipse.
> >
> >is there a better way to integrate with eclipse?
> >
> >Thanks
> >Yang
>
>
Re: avro-maven-plugin in eclipse?
Posted by Scott Carey <sc...@richrelevance.com>.
generate-sources in Eclipse works for me. (Helios, m2Eclipse plugin).
Sometimes, I have to right click on a project and select "Maven > Update
Project Configuration" to get it to generate the sources. It doesn't
automatically run generate-sources if you change a schema file, but a
project clean will trigger it for me.
On 5/25/11 2:54 PM, "Yang" <te...@gmail.com> wrote:
>it seems that eclipse can't run the generate-sources phase, so that I
>have to
>do 'mvn generate-sources" outside of eclipse, and then import the
>sources from eclipse.
>
>is there a better way to integrate with eclipse?
>
>Thanks
>Yang