Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails behind proxy / download mechanism #61

Closed
bmarwell opened this issue Sep 6, 2018 · 5 comments
Closed

Fails behind proxy / download mechanism #61

bmarwell opened this issue Sep 6, 2018 · 5 comments

Comments

@bmarwell
Copy link

bmarwell commented Sep 6, 2018

Hi,

I cannot directly connect to maven central, but I use a mirror repository.
However, I cannot use it as the URL is hardcoded.

Also, you don't use maven mechanisms and http. The bug report for this is here: os72/protoc-jar#55

This issue is for to keep track of inclusion of the fix in the library into this plugin.

@os72
Copy link
Owner

os72 commented Sep 6, 2018

Configuring parameter protocArtifact will make the plugin use standard maven resolution (instead of protoc-jar download), that may work for you

@bmarwell
Copy link
Author

bmarwell commented Sep 6, 2018

Good to know. My maven build actually froze. Even with -X I wasn't able to see what's going on.
It should print a message like: going to download from.... Your maven repo, directly, etc. and a link to the wiki page.

I'll look into prototyping something in the other issue.

@bmarwell
Copy link
Author

bmarwell commented Sep 7, 2018

@os72 if I configure protocArtifact, I will get a NullPointerException:

[INFO] Resolving artifact: com.google.protobuf:protoc:3.6.1, platform: linux-x86_64
protoc-jar: executing: [/tmp/protoc2145031032623482805.exe, --version]
libprotoc 3.6.1
[INFO] Protoc command: /tmp/protoc2145031032623482805.exe
[INFO] Additional include types: /tmp/protocjar1243971852487828800/include
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] myproject-parent - Definitions                 ..... SUCCESS [  0.900 s]
[INFO] Protobuf classes for Client and Server communication FAILURE [  0.277 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.217 s
[INFO] Finished at: 2018-09-07T14:26:54+02:00
[INFO] Final Memory: 37M/259M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.os72:protoc-jar-maven-plugin:3.6.0.1:run (default) on project wire-api: Execution default of goal com.github.os72:protoc-jar-maven-plugin:3.6.0.1:run failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.os72:protoc-jar-maven-plugin:3.6.0.1:run (default) on project wire-api: Execution default of goal com.github.os72:protoc-jar-maven-plugin:3.6.0.1:run failed.
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
        at java.lang.reflect.Method.invoke(Method.java:508)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal com.github.os72:protoc-jar-maven-plugin:3.6.0.1:run failed.
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
Caused by: java.lang.NullPointerException
        at com.github.os72.protocjar.Protoc.extractStdTypes(Protoc.java:378)
        at com.github.os72.protocjar.maven.ProtocJarMojo.performProtoCompilation(ProtocJarMojo.java:388)
        at com.github.os72.protocjar.maven.ProtocJarMojo.execute(ProtocJarMojo.java:327)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        ... 21 more

Here is my config:

      <plugin>
        <groupId>com.github.os72</groupId>
        <artifactId>protoc-jar-maven-plugin</artifactId>
        <version>3.6.0.1</version>
        <configuration>
          <!-- if it was set to true, it'd try to download it directly. -->
          <!-- <protocVersion>${dependency.protoc.version}</protocVersion> -->
          <includeStdTypes>true</includeStdTypes>

          <!-- get a special artifact from maven.-->
          <protocArtifact>com.google.protobuf:protoc:${dependency.protoc.version}</protocArtifact>

          <outputTargets>
            <outputTarget>
              <type>java</type>
              <outputDirectory>target/generated-sources/protobuf-java</outputDirectory>
            </outputTarget>
            <outputTarget>
              <type>js</type>
              <outputDirectory>target/generated-sources/protobuf-js</outputDirectory>
            </outputTarget>
            <outputTarget>
              <type>grpc-java</type>
              <pluginArtifact>io.grpc:protoc-gen-grpc-java:${dependency.grpc.version}</pluginArtifact>
              <outputDirectory>target/generated-sources/grpc-java</outputDirectory>
            </outputTarget>
          </outputTargets>
        </configuration>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

However, if if uncomment the protocVersion tag, it will work again.

@os72
Copy link
Owner

os72 commented Sep 7, 2018

Yes we could call it a bug :)
See if includeMavenTypes may work in your case (in a way it obsoletes includeStdTypes)

@os72
Copy link
Owner

os72 commented Oct 2, 2018

Assuming closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants