Compile Error when killing topology from storm bol

2019-03-01 15:07发布

问题:

I was looking for how to kill a topology from a storm bolt in storm 1.2.1 in my scala project. From this answer, I wrote following code to do it:

  private def shutTopology(){
    import org.apache.storm.utils.Utils
    import org.apache.storm.utils.NimbusClient
    val conf = Utils.readStormConfig
    val nimbusClient = 
NimbusClient.getConfiguredClient(conf).getClient
    nimbusClient.deactivate(topology_name)
  }

But it given following error in line: val conf = Utils.readStormConfig, How to resolve this?

Error:(46, 17) package daemon contains object and package with same name: nimbus

one of them needs to be removed from classpath

val conf = Utils.readStormConfig

I get above error by compiling via both sbt and mvn. I see some description for this here but not much help on how to resolve this.

Edit:

Based on the answer here, I was able to compile this in sbt using following scalac options:

"-Yresolve-term-conflict:object"

I am stil not able to get this done how to resolve this error when compiling with maven.

回答1:

Based on the answer here, I was able to compile this in sbt using following scalac options:

"-Yresolve-term-conflict:object"

to get this compiled with maven, I did following changes in my pom.xml as suggested here:

<configuration>
      <scalaVersion>${scala.version}</scalaVersion>
      <args>
        <arg>-Yresolve-term-conflict:object</arg> //this was added
      </args>
      <jvmArgs>
        <jvmArg>-Xms2048m</jvmArg>
        <jvmArg>-Xmx4096m</jvmArg>
      </jvmArgs>
</configuration>