我是新来的Linux和的Protobuf。我需要帮助。
我想“MVN套装”包含许多“.proto”文件的项目,当然一个pom.xml文件...
我工作在Ubuntu
=======================================
错误
当我运行“MVN套装”,我收到此错误:
后
...
Compiling 11 source files to .../target/classes
...
我得到了一堆这样的错误:
[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]
=======================================
POM
下面是pom.xml文件,用的groupId和artifactId的取出:
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>*****</groupId>
<artifactId>*****</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>*****</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<proto.cas.path>${project.basedir}/src</proto.cas.path>
<target.gen.source.path>${project.basedir}/target/generated-sources</target.gen.source.path>
</properties>
<dependencies>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.4.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<includes><include>**/commonapps/**</include></includes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<tasks>
<mkdir dir="${target.gen.source.path}" />
<path id="proto.path.files">
<fileset dir="${proto.cas.path}">
<include name="*.proto" />
</fileset>
</path>
<pathconvert pathsep=" " property="proto.files" refid="proto.path.files" />
<exec executable="protoc">
<arg value="--java_out=${target.gen.source.path}" />
<arg value="--proto_path=${proto.cas.path}" />
<arg line="${proto.files}" />
</exec>
</tasks>
<sourceRoot>${target.gen.source.path}</sourceRoot>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
=======================================
protobuf的安装
我弄完了
./configure
make
make check
make install
在protobuf的/,
和
mvn test
mvn install
mvn package
在protobuf的/ JAVA。
我把罐子中的protobuf / JAVA /目标
并把它添加到我的Maven的回购运行:
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
请注意,我用$ LD_LIBRARY_PATH好惹的。 目前,当我运行呼应它,我得到:
/usr/local/lib/:/usr/:/usr/lib/:/usr/local/
是啊....你能告诉我没有有关设置$ LD_LIBRARY_PATH线索
我也跑了:
apt-get install protobuf-compiler
=======================================
PROTOC安装
我忘了我做了什么,使protoc工作,但是当我运行
protoc --version
我得到
libprotoc 2.5.0
=======================================
我的问题是类似于:
使用与Java和Scala protobufs问题
行家编译失败
=======================================
可能的RELAVENCE?
因为还没有找到包后“MVN安装”
http://www.scriptol.com/programming/protocol-buffers-tutorial.php
任何人都可以帮忙吗?
=======================================
进展
显然,这是一个插件出现故障:
https://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[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: