Essential tags for building the java project using maven in pom.xml -


i building java project using maven couldn't succeed. so, can please tell me essential tags , corresponding values required in pom.xml build project? also, how add storm dependencies manually command line?

my directory structure of project :

root  |  |----com--->test----->newpackage---->*.class  |--- meta-inf------>manifest.mf  |----resource----->words.txt  |----pom.xml  |-----*.jar 

initially tried maven link , create pom.xml :

<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">     <build>     <plugins>       <plugin>         <groupid>org.apache.maven.plugins</groupid>         <artifactid>maven-shade-plugin</artifactid>         <version>1.6</version>         <executions>           <execution>             <phase>com.test.newpackage</phase>             <goals>               <goal>shade</goal>             </goals>           </execution>         </executions>       </plugin>     </plugins>   </build> </project> 

but, after use mvn package. throw exception :

[info] scanning projects... [info] ------------------------------------------------------------------------ [error] fatal error [info] ------------------------------------------------------------------------ [info] error building pom (may not project's pom).   project id: unknown pom location: /home/naresh/desktop/sharedfolder/stormeclipse/pom.xml  reason: not v4.0.0 pom. project unknown @ /home/naresh/desktop/sharedfolder/stormeclipse/pom.xml   [info] ------------------------------------------------------------------------ [info] trace org.apache.maven.reactor.mavenexecutionexception: not v4.0.0 pom. project unknown @ /home/naresh/desktop/sharedfolder/stormeclipse/pom.xml     @ org.apache.maven.defaultmaven.getprojects(defaultmaven.java:404)     @ org.apache.maven.defaultmaven.doexecute(defaultmaven.java:272)     @ org.apache.maven.defaultmaven.execute(defaultmaven.java:138)     @ org.apache.maven.cli.mavencli.main(mavencli.java:362)     @ org.apache.maven.cli.compat.compatiblemain.main(compatiblemain.java:60)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ org.codehaus.classworlds.launcher.launchenhanced(launcher.java:315)     @ org.codehaus.classworlds.launcher.launch(launcher.java:255)     @ org.codehaus.classworlds.launcher.mainwithexitcode(launcher.java:430)     @ org.codehaus.classworlds.launcher.main(launcher.java:375) caused by: org.apache.maven.project.invalidprojectmodelexception: not v4.0.0 pom. project unknown @ /home/naresh/desktop/sharedfolder/stormeclipse/pom.xml     @ org.apache.maven.project.defaultmavenprojectbuilder.readmodel(defaultmavenprojectbuilder.java:1599)     @ org.apache.maven.project.defaultmavenprojectbuilder.readmodel(defaultmavenprojectbuilder.java:1571)     @ org.apache.maven.project.defaultmavenprojectbuilder.buildfromsourcefileinternal(defaultmavenprojectbuilder.java:506)     @ org.apache.maven.project.defaultmavenprojectbuilder.build(defaultmavenprojectbuilder.java:200)     @ org.apache.maven.defaultmaven.getproject(defaultmaven.java:604)     @ org.apache.maven.defaultmaven.collectprojects(defaultmaven.java:487)     @ org.apache.maven.defaultmaven.getprojects(defaultmaven.java:391)     ... 12 more [info] ------------------------------------------------------------------------ [info] total time: < 1 second [info] finished at: mon jul 22 14:38:24 ist 2013 [info] final memory: 1m/15m [info] ------------------------------------------------------------------------ 

after used link maven link 2 , created pom.xml :

 <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">     <modelversion>4.0.0</modelversion>     <groupid>com.test.newpackage</groupid>     <artifactid>wordcount</artifactid>     <version>0.0.1</version>     <build>         <plugins>             <plugin>   <artifactid>maven-assembly-plugin</artifactid>   <configuration>     <descriptorrefs>         <descriptorref>jar-with-dependencies</descriptorref>     </descriptorrefs>     <archive>       <manifest>         <mainclass>com.test.newpackage</mainclass>       </manifest>     </archive>   </configuration> </plugin>         </plugins>     </build>     <repositories>         <!-- repository can found storm dependencies <repository>              <id>clojars.org</id> <url>http://clojars.org/repo</url> </repository> -->     </repositories>     <dependencies>         <!-- storm dependency -->         <dependency>             <groupid>storm</groupid>             <artifactid>storm</artifactid>             <version>0.8.1</version>         </dependency>     </dependencies> </project> 

this time throw exception :

[error] build error [info] ------------------------------------------------------------------------ [info] failed resolve artifact.  missing: ---------- 1) storm:storm:jar:0.8.1    try downloading file manually project website.    then, install using command:        mvn install:install-file -dgroupid=storm -dartifactid=storm -dversion=0.8.1 -dpackaging=jar -dfile=/path/to/file    alternatively, if host own repository can deploy file there:        mvn deploy:deploy-file -dgroupid=storm -dartifactid=storm -dversion=0.8.1 -dpackaging=jar -dfile=/path/to/file -durl=[url] -drepositoryid=[id]    path dependency:      1) com.test.newpackage:wordcount:jar:0.0.1     2) storm:storm:jar:0.8.1  ---------- 1 required artifact missing.  artifact:    com.test.newpackage:wordcount:jar:0.0.1  specified remote repositories:   central (http://repo1.maven.org/maven2) 

about structure:

maven assumes java classes in src/main/java , resources (anything in folder resource , meta-inf dir) in src/main/resources. directory structure described not work if tweak maven bit because of java classes in root dir (recursion). why don't use default structure? should have reason change this.

storm dependency:

you have link external repository in pom. outcommented. should work expected. if behind proxy have define proxy in settings.xml


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -