-2

I'm new to maven, I tried to use this command

mvn package 

The result is no file with dependencies.jar

which part of pom can i share it ? cause it's too long , i can't post it here

<plugins>
    <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
            <descriptorRefs>
                <descriptorRef>jar-with-dependencies</descriptorRef>
            </descriptorRefs>
            <archive>
                <manifest>
                    <mainClass>trident.myclass</mainClass>
                    <!-- <mainClass>crawler.Crawler</mainClass> -->
                </manifest>
            </archive>
        </configuration>
        <executions>
            <execution>
                <id>my-topology</id>
                <phase>package</phase>
                <goals>
                    <goal>jar</goal>
                </goals>
                <configuration>
                    <includes>
                        <include>/home/st/workspace/my-project/target/classes/trident/myclass.class
                        </include>
                    </includes>
                </configuration>
            </execution>
        </executions>
    </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
            <source>1.6</source>
            <target>1.6</target>
        </configuration>
    </plugin>
</plugins>

the previous error when i executed this command

mvn compile exec:java -Dexec.classPathScope=compile -Dexec.mainClass=trident.myproject

got this

java.lang.NoClassDefFoundError: storm/trident/state/StateFactory
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getMethod0(Class.java:2670)
at java.lang.Class.getMethod(Class.java:1603)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285)

then change from

<scope>provided</scope>

to

<scope>compile</scope>

then this error appeared when tried to submit topology

Exception in thread "main" java.lang.RuntimeException: Found multiple defaults.yaml resources. You're probably bundling the Storm jars with your topology jar.
  at backtype.storm.utils.Utils.findAndReadConfigFile(Utils.java:115)
  at backtype.storm.utils.Utils.readDefaultConfig(Utils.java:135)
  at backtype.storm.utils.Utils.readStormConfig(Utils.java:155)
  at backtype.storm.StormSubmitter.submitTopology(StormSubmitter.java:61)
  at backtype.storm.StormSubmitter.submitTopology(StormSubmitter.java:40)
  at trident.myproject.main(myproject.java:288)

and solved by changed assembly to jar in maven plugin with include the path of the main class

finally i don't want to change anything in pom cause the project in the first time i ran it ,, ran successfully without any errors

Matthias J. Sax
  • 59,682
  • 7
  • 117
  • 137

1 Answers1

1
question_maven_com
  • 2,457
  • 16
  • 21
  • 1
    i had problems before in the pom and someone advice me to change assembly to jar to solve it ,i'll post the previous errors –  Nov 02 '15 at 21:25
  • 1
    Good point: https://maven.apache.org/plugins/maven-assembly-plugin/usage.html – MariuszS Nov 02 '15 at 21:25
  • did you see the edit post ? –  Nov 02 '15 at 22:05
  • @user3188912 if you want to write message to someone directly, then use his nicnkname http://meta.stackexchange.com/questions/431/any-way-to-send-a-personal-message-to-another-user – MariuszS Nov 03 '15 at 08:33
  • What's the problem !!!! i asked everyone here –  Nov 03 '15 at 12:18