You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beam.apache.org by Shen Li <cs...@gmail.com> on 2016/11/04 05:02:19 UTC

Compilation Failure: release-0.2.0 referencing sdk-0.3.0

Hi,

I am trying to compile Beam 0.2.0 release, but got the following error.


[INFO] [ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.3:compile
(default-compile) on project basic: Compilation failure: Compilation
failure:
[INFO] [ERROR]
/homes/hny9/shenli/Project/incubator-beam/sdks/java/maven-archetypes/starter/target/test-classes/projects/basic/project/basic/src/main/java/it/pkg/StarterPipeline.
java:[60,7] method does not override or implement a method from a supertype
[INFO] [ERROR]
/homes/hny9/shenli/Project/incubator-beam/sdks/java/maven-archetypes/starter/target/test-classes/projects/basic/project/basic/src/main/java/it/pkg/StarterPipeline.
java:[54,7] method does not override or implement a method from a supertype

I looked at the code in StarterPipeline.java (as shown below). It is trying
to override the DoFn.processElement() method. In the 0.2.0 release,
processElement is still in DoFn rather than OldDoFn. I suspect it is
importing beam sdk 0.3.0. So, I clean the repo, and removed the beam fold
from ~/.m2. Still got the same error.

public class StarterPipeline {
  private static final Logger LOG = LoggerFactory.getLogger(StarterPipeline.
class);

  public static void main(String[] args) {
    Pipeline p = Pipeline.create(
        PipelineOptionsFactory.fromArgs(args).withValidation().create());

    p.apply(Create.of("Hello", "World"))
    .apply(ParDo.of(new DoFn<String, String>() {
      @Override
      public void processElement(ProcessContext c) {
        c.output(c.element().toUpperCase());
      }
    }))
    .apply(ParDo.of(new DoFn<String, Void>() {
      @Override
      public void processElement(ProcessContext c)  {
        LOG.info(c.element());
      }
    }));

    p.run();
  }
}


After the compilation, the 0.3.0 jar does exist in
~/.m2/repository/org/apache/beam/beam-sdks-java-core/0.3.0-incubating/. And
the pom.xml
in sdks/java/maven-archetypes/starter/target/test-classes/projects/basic/project/basic
is referencing the latest release in the repository.


   <dependency>
      <groupId>org.apache.beam</groupId>
      <artifactId>beam-sdks-java-core</artifactId>
      <version>[0-incubating, 1-incubating)</version>
    </dependency>


Can someone help with this?


Thanks,


Shen

Re: Compilation Failure: release-0.2.0 referencing sdk-0.3.0

Posted by Frances Perry <fj...@google.com.INVALID>.
When I was working on the pending quickstart guide [1] earlier today, I
found I had to specify -DarchetypeVersion=LATEST [2] during archetype
generation to avoid this issue.

$ mvn archetype:generate -DarchetypeGroupId=org.apache.beam
-DarchetypeArtifactId=beam-sdks-java-maven-archetypes-starter
-DarchetypeVersion=LATEST -DgroupId=org.example -DartifactId=beam-starter
-Dversion="0.1" -DinteractiveMode=false

However, that still doesn't get things immediately unblocked, because there
are no runner dependencies in the pom. Filed BEAM-909 [3].

In the meantime, you can edit the generated pom.xml to add the runner
dependencies by hand:

    <dependency>
      <groupId>org.apache.beam</groupId>
      <artifactId>beam-runners-direct-java</artifactId>
      <version>0.3.0-incubating</version>
    </dependency>


[1] https://github.com/apache/incubator-beam-site/pull/63
[2]
http://maven.apache.org/archetype/maven-archetype-plugin/generate-mojo.html
[3] https://issues.apache.org/jira/browse/BEAM-909

On Thu, Nov 3, 2016 at 10:02 PM, Shen Li <cs...@gmail.com> wrote:

> Hi,
>
> I am trying to compile Beam 0.2.0 release, but got the following error.
>
>
> [INFO] [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-compiler-plugin:3.3:compile
> (default-compile) on project basic: Compilation failure: Compilation
> failure:
> [INFO] [ERROR]
> /homes/hny9/shenli/Project/incubator-beam/sdks/java/
> maven-archetypes/starter/target/test-classes/projects/
> basic/project/basic/src/main/java/it/pkg/StarterPipeline.
> java:[60,7] method does not override or implement a method from a supertype
> [INFO] [ERROR]
> /homes/hny9/shenli/Project/incubator-beam/sdks/java/
> maven-archetypes/starter/target/test-classes/projects/
> basic/project/basic/src/main/java/it/pkg/StarterPipeline.
> java:[54,7] method does not override or implement a method from a supertype
>
> I looked at the code in StarterPipeline.java (as shown below). It is trying
> to override the DoFn.processElement() method. In the 0.2.0 release,
> processElement is still in DoFn rather than OldDoFn. I suspect it is
> importing beam sdk 0.3.0. So, I clean the repo, and removed the beam fold
> from ~/.m2. Still got the same error.
>
> public class StarterPipeline {
>   private static final Logger LOG = LoggerFactory.getLogger(
> StarterPipeline.
> class);
>
>   public static void main(String[] args) {
>     Pipeline p = Pipeline.create(
>         PipelineOptionsFactory.fromArgs(args).withValidation().create());
>
>     p.apply(Create.of("Hello", "World"))
>     .apply(ParDo.of(new DoFn<String, String>() {
>       @Override
>       public void processElement(ProcessContext c) {
>         c.output(c.element().toUpperCase());
>       }
>     }))
>     .apply(ParDo.of(new DoFn<String, Void>() {
>       @Override
>       public void processElement(ProcessContext c)  {
>         LOG.info(c.element());
>       }
>     }));
>
>     p.run();
>   }
> }
>
>
> After the compilation, the 0.3.0 jar does exist in
> ~/.m2/repository/org/apache/beam/beam-sdks-java-core/0.3.0-incubating/.
> And
> the pom.xml
> in sdks/java/maven-archetypes/starter/target/test-classes/
> projects/basic/project/basic
> is referencing the latest release in the repository.
>
>
>    <dependency>
>       <groupId>org.apache.beam</groupId>
>       <artifactId>beam-sdks-java-core</artifactId>
>       <version>[0-incubating, 1-incubating)</version>
>     </dependency>
>
>
> Can someone help with this?
>
>
> Thanks,
>
>
> Shen
>