java - How to fix "import com.dyuproject cannot be resolved" error -


i'm new java , new maven , protostuff project (protostuff website). need use protostuff serialize/deserialize xml google's protobuf format. tried using protobuf-java-format package, there's documented error in deserialization show-stopper me (issue 37).

so far i've done following:

  1. downloaded protostuff-1.3.1 & extracted it.
  2. ran mvn integration-test, mvn install , mvn packageand steps succeeded.
  3. i created new maven project , included proto described here
  4. i modified pom.xml , ran protostuff:compile on proto described in aforementioned link, generating following person.java file

    // generated http://code.google.com/p/protostuff/ ... not edit! // generated foo.proto  package com.example.foo;  import java.io.externalizable; import java.io.ioexception; import java.io.objectinput; import java.io.objectoutput;  import com.dyuproject.protostuff.bytestring; import com.dyuproject.protostuff.graphioutil; import com.dyuproject.protostuff.input; import com.dyuproject.protostuff.message; import com.dyuproject.protostuff.output; import com.dyuproject.protostuff.schema; import com.dyuproject.protostuff.uninitializedmessageexception;  public final class person implements externalizable, message<person>, schema<person> {     public enum gender implements com.dyuproject.protostuff.enumlite<gender>     {         male(1),         female(2);          public final int number;          private gender (int number)         {             this.number = number;         }          public int getnumber()         {             return number;         }          public static gender valueof(int number)         {             switch(number)              {                 case 1: return male;                 case 2: return female;                 default: return null;             }         }     }       public static schema<person> getschema()     {         return default_instance;     }      public static person getdefaultinstance()     {         return default_instance;     }      static final person default_instance = new person();      static final string default_motto = bytestring.stringdefaultvalue("when cat away, mouse alone!");     static final gender default_gender = gender.male;      private integer id;     private string name;     private string motto = default_motto;     private gender gender;      public person()     {      }      public person(         integer id     )     {         this.id = id;     }      // getters , setters      // id      public integer getid()     {         return id;     }      public void setid(integer id)     {         this.id = id;     }      // name      public string getname()     {         return name;     }      public void setname(string name)     {         this.name = name;     }      // motto      public string getmotto()     {         return motto;     }      public void setmotto(string motto)     {         this.motto = motto;     }      // gender      public gender getgender()     {         return gender == null ? gender.male : gender;     }      public void setgender(gender gender)     {         this.gender = gender;     }      // java serialization      public void readexternal(objectinput in) throws ioexception     {         graphioutil.mergedelimitedfrom(in, this, this);     }      public void writeexternal(objectoutput out) throws ioexception     {         graphioutil.writedelimitedto(out, this, this);     }      // message method      public schema<person> cachedschema()     {         return this;     }      // schema methods      public person newmessage()     {         return new person();     }      public class<person> typeclass()     {         return person.class;     }      public string messagename()     {         return person.class.getsimplename();     }      public string messagefullname()     {         return person.class.getname();     }      public boolean isinitialized(person message)     {         return              message.id != null;     }      public void mergefrom(input input, person message) throws ioexception     {         for(int number = input.readfieldnumber(this);; number = input.readfieldnumber(this))         {             switch(number)             {                 case 0:                     return;                 case 1:                     message.id = input.readint32();                     break;                 case 2:                     message.name = input.readstring();                     break;                 case 3:                     message.motto = input.readstring();                     break;                 case 4:                     message.gender = gender.valueof(input.readenum());                     break;                 default:                     input.handleunknownfield(number, this);             }            }     }       public void writeto(output output, person message) throws ioexception     {         if(message.id == null)             throw new uninitializedmessageexception(message);         output.writeint32(1, message.id, false);          if(message.name != null)             output.writestring(2, message.name, false);          if(message.motto != null && message.motto != default_motto)             output.writestring(3, message.motto, false);          if(message.gender != null)              output.writeenum(4, message.gender.number, false);     }      public string getfieldname(int number)     {         switch(number)         {             case 1: return "id";             case 2: return "name";             case 3: return "motto";             case 4: return "gender";             default: return null;         }     }      public int getfieldnumber(string name)     {         final integer number = __fieldmap.get(name);         return number == null ? 0 : number.intvalue();     }      private static final java.util.hashmap<string,integer> __fieldmap = new java.util.hashmap<string,integer>();     static     {         __fieldmap.put("id", 1);         __fieldmap.put("name", 2);         __fieldmap.put("motto", 3);         __fieldmap.put("gender", 4);     }  } 

i'm building whole project in eclipse (luna release) , gives error "import com.dyuproject cannot resolved" above file. don't understand why gives error or how find/install package eclipse can see it. should maven have built/provided that?

i'm running centos release 6.4 (final) on virtualbox vm:

uname -a linux localhost.localdomain 2.6.32-358.18.1.el6.x86_64 #1 smp wed aug 28 17:19:38 utc 2013 x86_64 x86_64 x86_64 gnu/linux `

looks using incompatible protostuff-core , protostuff-maven-plugin versions.

starting version 1.1, protostuff uses package io.protostuff instead of com.dyuproject.protostuff. protostuff dependency version , protostuff maven plugin version should equal (1.3.5 latest version).

here example of maven project uses protostuff-maven-plugin code generation.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -