Note that there are some explanatory texts on larger screens.

plurals
  1. POMaven & Protobuf compile error: Cannot find symbol in package com.google.protobuf
    text
    copied!<p>I'm new to Linux and Protobuf.. I need help. </p> <p>I'm trying to "mvn package" a project that contains many ".proto" files, and a pom.xml file of course...</p> <p>I'm working on Ubuntu</p> <p>=======================================</p> <h1>ERROR</h1> <p>When I run "mvn package", I receive this error:</p> <p>after </p> <pre><code>... Compiling 11 source files to .../target/classes ... </code></pre> <p>I get a bunch of these errors:</p> <pre><code>[ERROR] .../target/generated-sources/...java:[16457,30] cannot find symbol [ERROR] symbol : class Parser [ERROR] location: package com.google.protobuf [ERROR] [ERROR] .../target/generated-sources/...java:[17154,37] cannot find symbol [ERROR] symbol : class Parser [ERROR] location: package com.google.protobuf [ERROR] [ERROR] .../target/generated-sources/...java:[17165,30] cannot find symbol [ERROR] symbol : class Parser [ERROR] location: package com.google.protobuf [ERROR] [ERROR] .../target/generated-sources/...java:[17909,37] cannot find symbol [ERROR] symbol : class Parser [ERROR] location: package com.google.protobuf [ERROR] </code></pre> <p>=======================================</p> <h1>POM</h1> <p>Here is the pom.xml file, with groupId &amp; artifactId taken out:</p> <pre class="lang-xml prettyprint-override"><code>&lt;project&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;parent&gt; &lt;groupId&gt;*****&lt;/groupId&gt; &lt;artifactId&gt;*****&lt;/artifactId&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;/parent&gt; &lt;artifactId&gt;*****&lt;/artifactId&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;properties&gt; &lt;proto.cas.path&gt;${project.basedir}/src&lt;/proto.cas.path&gt; &lt;target.gen.source.path&gt;${project.basedir}/target/generated-sources&lt;/target.gen.source.path&gt; &lt;/properties&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;com.google.protobuf&lt;/groupId&gt; &lt;artifactId&gt;protobuf-java&lt;/artifactId&gt; &lt;version&gt;2.4.1&lt;/version&gt; &lt;scope&gt;compile&lt;/scope&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;build&gt; &lt;sourceDirectory&gt;${project.basedir}/src&lt;/sourceDirectory&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;version&gt;2.0.2&lt;/version&gt; &lt;configuration&gt; &lt;source&gt;1.6&lt;/source&gt; &lt;target&gt;1.6&lt;/target&gt; &lt;includes&gt;&lt;include&gt;**/commonapps/**&lt;/include&gt;&lt;/includes&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;generate-sources&lt;/id&gt; &lt;phase&gt;generate-sources&lt;/phase&gt; &lt;configuration&gt; &lt;tasks&gt; &lt;mkdir dir="${target.gen.source.path}" /&gt; &lt;path id="proto.path.files"&gt; &lt;fileset dir="${proto.cas.path}"&gt; &lt;include name="*.proto" /&gt; &lt;/fileset&gt; &lt;/path&gt; &lt;pathconvert pathsep=" " property="proto.files" refid="proto.path.files" /&gt; &lt;exec executable="protoc"&gt; &lt;arg value="--java_out=${target.gen.source.path}" /&gt; &lt;arg value="--proto_path=${proto.cas.path}" /&gt; &lt;arg line="${proto.files}" /&gt; &lt;/exec&gt; &lt;/tasks&gt; &lt;sourceRoot&gt;${target.gen.source.path}&lt;/sourceRoot&gt; &lt;/configuration&gt; &lt;goals&gt; &lt;goal&gt;run&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;/project&gt; </code></pre> <p></p> <p>=======================================</p> <h1>PROTOBUF INSTALLATION</h1> <p>I've done</p> <pre><code>./configure make make check make install </code></pre> <p>in protobuf/,</p> <p>and </p> <pre><code>mvn test mvn install mvn package </code></pre> <p>in protobuf/java.</p> <p>I took the jar in protobuf/java/target</p> <p>and added it to my maven repo by running:</p> <pre><code>mvn install:install-file -Dpackaging=jar -DgeneratePom=true -DgroupId=com.google.protobuf -DartifactId=protobuf-java -Dfile=protobuf-java-2.4.1.jar -Dversion=2.4.1 </code></pre> <p>Note that I've messed around with $LD_LIBRARY_PATH. Currently when I run echo it, I get:</p> <pre><code>/usr/local/lib/:/usr/:/usr/lib/:/usr/local/ </code></pre> <p>yeah.... as you can tell I don't have a clue about setting $LD_LIBRARY_PATH</p> <p>I also ran:</p> <pre><code>apt-get install protobuf-compiler </code></pre> <p>=======================================</p> <h1>PROTOC INSTALLATION</h1> <p>I forgot what I did to make protoc work, but when I run</p> <pre><code>protoc --version </code></pre> <p>I get</p> <pre><code>libprotoc 2.5.0 </code></pre> <p>=======================================</p> <h1>MY QUESTION IS SIMILAR TO:</h1> <p><a href="https://stackoverflow.com/questions/8265801/problems-using-protobufs-with-java-and-scala">Problems using protobufs with java and scala</a></p> <p><a href="https://stackoverflow.com/questions/1589121/maven-compilation-failure">maven compilation failure</a></p> <p>=======================================</p> <h1>POSSIBLE RELAVENCE?</h1> <p><a href="https://stackoverflow.com/questions/12509050/still-not-find-package-after-mvn-install">still not find package, after &#39;mvn install&#39;</a></p> <p><a href="http://www.scriptol.com/programming/protocol-buffers-tutorial.php" rel="nofollow noreferrer">http://www.scriptol.com/programming/protocol-buffers-tutorial.php</a></p> <p>Can anyone help?</p> <p>=======================================</p> <h1>PROGRESS</h1> <p>Apparently it's a plugin failure:</p> <p><a href="https://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException" rel="nofollow noreferrer">https://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException</a></p> <pre><code>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project casprotobuf: Compilation failure: Compilation failure: </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload