 |
BOOK: Professional Java for Web Applications
 | This is the forum to discuss the Wrox book Professional Java for Web Applications by Nicholas S. Williams; ISBN: 978-1-118-65646-4 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Professional Java for Web Applications section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

November 16th, 2014, 11:32 AM
|
Registered User
|
|
Join Date: Nov 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
maven archetype
Hi,
i want to create project from scratch,
what is the archetype of maven to use in each example?
thanks.
|

October 2nd, 2015, 01:23 AM
|
Registered User
|
|
Join Date: Jun 2014
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
maven archetype
The archetype I have found to work for me creating projects similar to the code included with the book is the maven-archetype-webapp. One issue I have found though is that this archetype creates a project with a version 2.5 Deployment Descriptor (web.xml file), but the examples in the book use version 3.1. So after I create the project from the maven command line I change the web.xml file to the proper version before I import the project into Eclipse.
The archetype command is:
mvn archetype:generate -DarchetypeArtifactId=maven-archetype-webapp
|

January 12th, 2016, 11:53 AM
|
Wrox Author
|
|
Join Date: Jun 2014
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I'll look into making some Maven archetypes to match the project, which should hopefully make things easier for folks to create similar projects. Before I do, what would you like to see? A full archetype for everything needed for the last chapter (the largest, most complete project that includes persistence and security)? Or something more pared-down? Or staged archetypes for different phases of the book?
__________________
-- Nick Williams
|

January 12th, 2016, 10:56 PM
|
Registered User
|
|
Join Date: Jun 2014
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
My preference is for staged archetypes for the different phases of the book. I think that would be very helpful.
|

February 10th, 2016, 06:31 AM
|
Authorized User
|
|
Join Date: Mar 2012
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by photoelectric
The archetype I have found to work for me creating projects similar to the code included with the book is the maven-archetype-webapp. One issue I have found though is that this archetype creates a project with a version 2.5 Deployment Descriptor (web.xml file), but the examples in the book use version 3.1. So after I create the project from the maven command line I change the web.xml file to the proper version before I import the project into Eclipse.
The archetype command is:
mvn archetype:generate -DarchetypeArtifactId=maven-archetype-webapp
|
Hi
On the samelines i crated a project using the maven command
mvn.cmd archetype:generate -DarchetypeArtifactId=maven-archetype-webapp
please tell me how to make use of this succesfull building in maven for furthe making jar war test and site
as shown in this code
thanks
As
muthukutta1
Code:
mvn.cmd archetype:generate -DarchetypeArtifactId=maven-archetype-webapp
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.4:generate (default-cli) > generate-sources
@ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.4:generate (default-cli) < generate-sources
@ standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.4:generate (default-cli) @ standalone-pom --
-
[INFO] Generating project in Interactive mode
[WARNING] Error reading archetype catalog http://repo.maven.apache.org/maven2
org.apache.maven.wagon.TransferFailedException: repo.maven.apache.org
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInp
utData(AbstractHttpClientWagon.java:1066)
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInp
utData(AbstractHttpClientWagon.java:960)
at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:11
6)
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
at org.apache.maven.archetype.source.RemoteCatalogArchetypeDataSource.do
wnloadCatalog(RemoteCatalogArchetypeDataSource.java:119)
at org.apache.maven.archetype.source.RemoteCatalogArchetypeDataSource.ge
tArchetypeCatalog(RemoteCatalogArchetypeDataSource.java:87)
at org.apache.maven.archetype.DefaultArchetypeManager.getRemoteCatalog(D
efaultArchetypeManager.java:216)
at org.apache.maven.archetype.DefaultArchetypeManager.getRemoteCatalog(D
efaultArchetypeManager.java:205)
at org.apache.maven.archetype.ui.generation.DefaultArchetypeSelector.get
ArchetypesByCatalog(DefaultArchetypeSelector.java:200)
at org.apache.maven.archetype.ui.generation.DefaultArchetypeSelector.sel
ectArchetype(DefaultArchetypeSelector.java:71)
at org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.execu
te(CreateProjectFromArchetypeMojo.java:181)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:207)
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.buildProje
ct(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThre
adedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.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:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
356)
Caused by: java.net.UnknownHostException: repo.maven.apache.org
at java.net.InetAddress.getAllByName0(InetAddress.java:1215)
at java.net.InetAddress.getAllByName(InetAddress.java:1127)
at java.net.InetAddress.getAllByName(InetAddress.java:1063)
at org.apache.maven.wagon.providers.http.httpclient.impl.conn.SystemDefa
ultDnsResolver.resolve(SystemDefaultDnsResolver.java:44)
at org.apache.maven.wagon.providers.http.httpclient.impl.conn.HttpClient
ConnectionOperator.connect(HttpClientConnectionOperator.java:101)
at org.apache.maven.wagon.providers.http.httpclient.impl.conn.PoolingHtt
pClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainC
lientExec.establishRoute(MainClientExec.java:363)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainC
lientExec.execute(MainClientExec.java:219)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.Proto
colExec.execute(ProtocolExec.java:195)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.Retry
Exec.execute(RetryExec.java:86)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.Redir
ectExec.execute(RedirectExec.java:108)
at org.apache.maven.wagon.providers.http.httpclient.impl.client.Internal
HttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.maven.wagon.providers.http.httpclient.impl.client.Closeabl
eHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.execute
(AbstractHttpClientWagon.java:832)
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInp
utData(AbstractHttpClientWagon.java:983)
... 33 more
[WARNING] No archetype found in remote catalog. Defaulting to internal catalog
Define value for property 'groupId': : maven-3.3.9
Define value for property 'artifactId': : apache-maven-3.3.9
Define value for property 'version': 1.0-SNAPSHOT: : apache-maven-3.3.9-1
Define value for property 'package': maven-3.3.9: : apache-maven-3.3.9
Confirm properties configuration:
groupId: maven-3.3.9
artifactId: apache-maven-3.3.9
version: apache-maven-3.3.9-1
package: apache-maven-3.3.9
Y: : Y
[INFO] -------------------------------------------------------------------------
---
[INFO] Using following parameters for creating project from Old (1.x) Archetype:
maven-archetype-webapp:1.0
[INFO] -------------------------------------------------------------------------
---
[INFO] Parameter: groupId, Value: maven-3.3.9
[INFO] Parameter: packageName, Value: apache-maven-3.3.9
[INFO] Parameter: package, Value: apache-maven-3.3.9
[INFO] Parameter: artifactId, Value: apache-maven-3.3.9
[INFO] Parameter: basedir, Value: D:\Program Files\java\jdk1.7.0_07\bin\apache-m
aven-3.3.9\bin
[INFO] Parameter: version, Value: apache-maven-3.3.9-1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 06:09 min
[INFO] Finished at: 2016-02-05T23:44:44-08:00
[INFO] Final Memory: 11M/28M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2
.4:generate (default-cli) on project standalone-pom: Directory apache-maven-3.3.
9 already exists - please run from a clean directory -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption
D:\Program Files\java\jdk1.7.0_07\bin\apache-maven-3.3.9\bin>mvn.cmd archetype:g
enerate -DarchetypeArtifactId=maven-archetype-webapp
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.4:generate (default-cli) > generate-sources
@ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.4:generate (default-cli) < generate-sources
@ standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.4:generate (default-cli) @ standalone-pom --
-
[INFO] Generating project in Interactive mode
[WARNING] Error reading archetype catalog http://repo.maven.apache.org/maven2
org.apache.maven.wagon.TransferFailedException: repo.maven.apache.org
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInp
utData(AbstractHttpClientWagon.java:1066)
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInp
utData(AbstractHttpClientWagon.java:960)
at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:11
6)
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
at org.apache.maven.archetype.source.RemoteCatalogArchetypeDataSource.do
wnloadCatalog(RemoteCatalogArchetypeDataSource.java:119)
at org.apache.maven.archetype.source.RemoteCatalogArchetypeDataSource.ge
tArchetypeCatalog(RemoteCatalogArchetypeDataSource.java:87)
at org.apache.maven.archetype.DefaultArchetypeManager.getRemoteCatalog(D
efaultArchetypeManager.java:216)
at org.apache.maven.archetype.DefaultArchetypeManager.getRemoteCatalog(D
efaultArchetypeManager.java:205)
at org.apache.maven.archetype.ui.generation.DefaultArchetypeSelector.get
ArchetypesByCatalog(DefaultArchetypeSelector.java:200)
at org.apache.maven.archetype.ui.generation.DefaultArchetypeSelector.sel
ectArchetype(DefaultArchetypeSelector.java:71)
at org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.execu
te(CreateProjectFromArchetypeMojo.java:181)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:207)
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.buildProje
ct(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThre
adedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.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:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
356)
Caused by: java.net.UnknownHostException: repo.maven.apache.org
at java.net.InetAddress.getAllByName0(InetAddress.java:1215)
at java.net.InetAddress.getAllByName(InetAddress.java:1127)
at java.net.InetAddress.getAllByName(InetAddress.java:1063)
at org.apache.maven.wagon.providers.http.httpclient.impl.conn.SystemDefa
ultDnsResolver.resolve(SystemDefaultDnsResolver.java:44)
at org.apache.maven.wagon.providers.http.httpclient.impl.conn.HttpClient
ConnectionOperator.connect(HttpClientConnectionOperator.java:101)
at org.apache.maven.wagon.providers.http.httpclient.impl.conn.PoolingHtt
pClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainC
lientExec.establishRoute(MainClientExec.java:363)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainC
lientExec.execute(MainClientExec.java:219)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.Proto
colExec.execute(ProtocolExec.java:195)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.Retry
Exec.execute(RetryExec.java:86)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.Redir
ectExec.execute(RedirectExec.java:108)
at org.apache.maven.wagon.providers.http.httpclient.impl.client.Internal
HttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.maven.wagon.providers.http.httpclient.impl.client.Closeabl
eHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.execute
(AbstractHttpClientWagon.java:832)
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInp
utData(AbstractHttpClientWagon.java:983)
... 33 more
[WARNING] No archetype found in remote catalog. Defaulting to internal catalog
Define value for property 'groupId': : soundarya1
Define value for property 'artifactId': : sundarya2
Define value for property 'version': 1.0-SNAPSHOT: : soundarya3
Define value for property 'package': soundarya1: : soundarya4
Confirm properties configuration:
groupId: soundarya1
artifactId: sundarya2
version: soundarya3
package: soundarya4
Y: : Y
[INFO] -------------------------------------------------------------------------
---
[INFO] Using following parameters for creating project from Old (1.x) Archetype:
maven-archetype-webapp:1.0
[INFO] -------------------------------------------------------------------------
---
[INFO] Parameter: groupId, Value: soundarya1
[INFO] Parameter: packageName, Value: soundarya4
[INFO] Parameter: package, Value: soundarya4
[INFO] Parameter: artifactId, Value: sundarya2
[INFO] Parameter: basedir, Value: D:\Program Files\java\jdk1.7.0_07\bin\apache-m
aven-3.3.9\bin
[INFO] Parameter: version, Value: soundarya3
[INFO] project created from Old (1.x) Archetype in dir: D:\Program Files\java\jd
k1.7.0_07\bin\apache-maven-3.3.9\bin\sundarya2
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 53.281 s
[INFO] Finished at: 2016-02-05T23:46:01-08:00
[INFO] Final Memory: 11M/28M
[INFO] ------------------------------------------------------------------------
|

February 12th, 2016, 12:46 PM
|
Registered User
|
|
Join Date: Jun 2014
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
From your error message it looks like you are having trouble reaching the Maven Central Repo. Are you behind a proxy? If you are, then you need to add the proxy info to the settings.xml file in your maven installation's conf directory.
|

February 15th, 2016, 04:21 AM
|
Authorized User
|
|
Join Date: Mar 2012
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Maven usage in jar creation
Quote:
Originally Posted by photoelectric
From your error message it looks like you are having trouble reaching the Maven Central Repo. Are you behind a proxy? If you are, then you need to add the proxy info to the settings.xml file in your maven installation's conf directory.
|
Hi
Thanks.However,on a methodical way,I was able to create a jar file for an application prg in java using the mvn.cmd command.
But it is empty one with the name 1.0SNAPSHOT.jar with maven-archiver folder ofcourse .Please let me know the correct command to make
maven create a fully exexcutable jar file
The first method was as below:
mvn.cmd archetype:generate -DarchetypeArtifactId=maven-archetype - webapp
The next usage was
mvn.cmd clean jar:jar
This resulted in target with jar as said above
Though the error is minor i the fixing for the creation of jar may be helpful contexually
As
muthukutta1
An example showing the jar file .How to make t executable
Thanks
Code:
mvn.cmd clean install
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for
com.lottery:Lottery:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-comp
iler-plugin is missing. @ line 21, column 17
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten t
he stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support buildin
g such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Lottery number generator: Good Luck 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Lottery ---
[INFO] Deleting D:\Program Files\java\jdk1.7.0_07\bin\apache-maven-3.3.9\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Lottery --
-
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Program Files\java\jdk1.7.0_07\bin
\apache-maven-3.3.9\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Lottery ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Lo
ttery ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Program Files\java\jdk1.7.0_07\bin
\apache-maven-3.3.9\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ Lottery
---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ Lottery ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ Lottery ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: D:\Program Files\java\jdk1.7.0_07\bin\apache-maven-3.3.9\ta
rget\Lottery.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ Lottery ---
[INFO] Installing D:\Program Files\java\jdk1.7.0_07\bin\apache-maven-3.3.9\targe
t\Lottery.jar to C:\Documents and Settings\Administrator\.m2\repository\com\lott
ery\Lottery\1.0-SNAPSHOT\Lottery-1.0-SNAPSHOT.jar
[INFO] Installing D:\Program Files\java\jdk1.7.0_07\bin\apache-maven-3.3.9\pom.x
ml to C:\Documents and Settings\Administrator\.m2\repository\com\lottery\Lottery
\1.0-SNAPSHOT\Lottery-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.859 s
[INFO] Finished at: 2016-02-16T01:31:03-08:00
[INFO] Final Memory: 8M/19M
[INFO] ------------------------------------------------------------------------
Last edited by muthukutta1; February 15th, 2016 at 05:58 AM..
Reason: Sampler on maven usage shown-Jar is kept emty
|

April 9th, 2016, 11:24 PM
|
Authorized User
|
|
Join Date: Mar 2012
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
use of jar and webapp in java-Maven
Quote:
Originally Posted by muthukutta1
Hi
Thanks.However,on a methodical way,I was able to create a jar file for an application prg in java using the mvn.cmd command.
But it is empty one with the name 1.0SNAPSHOT.jar with maven-archiver folder ofcourse .Please let me know the correct command to make
maven create a fully exexcutable jar file
The first method was as below:
mvn.cmd archetype:generate -DarchetypeArtifactId=maven-archetype - webapp
The next usage was
mvn.cmd clean jar:jar
This resulted in target with jar as said above
Though the error is minor i the fixing for the creation of jar may be helpful contexually
As
muthukutta1
An example showing the jar file .How to make t executable
Thanks
Code:
mvn.cmd clean install
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for
com.lottery:Lottery:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-comp
iler-plugin is missing. @ line 21, column 17
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten t
he stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support buildin
g such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Lottery number generator: Good Luck 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Lottery ---
[INFO] Deleting D:\Program Files\java\jdk1.7.0_07\bin\apache-maven-3.3.9\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Lottery --
-
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Program Files\java\jdk1.7.0_07\bin
\apache-maven-3.3.9\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Lottery ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Lo
ttery ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Program Files\java\jdk1.7.0_07\bin
\apache-maven-3.3.9\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ Lottery
---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ Lottery ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ Lottery ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: D:\Program Files\java\jdk1.7.0_07\bin\apache-maven-3.3.9\ta
rget\Lottery.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ Lottery ---
[INFO] Installing D:\Program Files\java\jdk1.7.0_07\bin\apache-maven-3.3.9\targe
t\Lottery.jar to C:\Documents and Settings\Administrator\.m2\repository\com\lott
ery\Lottery\1.0-SNAPSHOT\Lottery-1.0-SNAPSHOT.jar
[INFO] Installing D:\Program Files\java\jdk1.7.0_07\bin\apache-maven-3.3.9\pom.x
ml to C:\Documents and Settings\Administrator\.m2\repository\com\lottery\Lottery
\1.0-SNAPSHOT\Lottery-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.859 s
[INFO] Finished at: 2016-02-16T01:31:03-08:00
[INFO] Final Memory: 8M/19M
[INFO] ------------------------------------------------------------------------
|
Hi
my sincere thanks for your valuable suggestion.that resulted ok but
for the tantalizing behaviour on use of war and jar,ie.if I put the word war
and compile ,I get a failure report while usge of jar was successfull as under .However jar so
produced is as usual non executable,inspite of the fact three special additional properties were included for the project by me
as webxml attribute but still invain in its enablence. But on the whole as you said already, i feel that war is rather
very combursome and hard .you may please have a glimpse especially for the pom of the follwing and
if possible do needfull correction.(as for example you may include the relevent webapp attributes to make it activate the war/jar
I also tried the same by writing lke the folowing but not so ok hence resulted in failure.)
<web-app>
url-pattern='servlet',servlet name ='invoker'
</web-app>
.
Atleast I am sure you would now be able to say authenticaly as to why is the jar always kept empty.What and where I should should add to
make it otherwise filledwith classes.
Thanks
As
muthukutta1
Code:
<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>BMI</groupId>
<artifactId>BMI.BMICalculator</artifactId>
<version>2.6</version>
<packaging>jar</packaging>
<name>BMI.BMICalculator</name>
<url>http://maven.apache.org</url>
<properties>
<web-app>servlet</web-app>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.model>jar</project.model>
<project.model>war</project.model>
<project.repo.remote>true</project.repo.remote>
<project.proxy.host>Administrator</project.proxy.host>
<project.scp.executable>true</project.scp.executable>
<project.repo.central>true</project.repo.central>
<project.src.dir>BMI</project.src.dir>
<project.build.dest>classes</project.build.dest>
<project.plugin.dir>maven-war-plugin-2.6</project.plugin.dir>
<project.build.sourceEncoding>BMI.BMICalculator</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
D:\Program Files\java\jdk1.7.0_07\bin\apache-maven-3.3.9>mvn.cmd clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building BMI.BMICalculator 2.6
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ BMI.BMICalculator ---
[INFO] Deleting D:\Program Files\java\jdk1.7.0_07\bin\apache-maven-3.3.9\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ BMI.BMICal
culator ---
[INFO] Using 'BMI.BMICalculator' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\Program Files\java\jdk1.7.0_07\bin
\apache-maven-3.3.9\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ BMI.BMICalculat
or ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ BM
I.BMICalculator ---
[INFO] Using 'BMI.BMICalculator' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\Program Files\java\jdk1.7.0_07\bin
\apache-maven-3.3.9\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ BMI.BMI
Calculator ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ BMI.BMICalculator
---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ BMI.BMICalculator ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: D:\Program Files\java\jdk1.7.0_07\bin\apache-maven-3.3.9\ta
rget\BMI.BMICalculator-2.6.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ BMI.BMICalculato
r ---
[INFO] Installing D:\Program Files\java\jdk1.7.0_07\bin\apache-maven-3.3.9\targe
t\BMI.BMICalculator-2.6.jar to C:\Documents and Settings\Administrator\.m2\repos
itory\BMI\BMI.BMICalculator\2.6\BMI.BMICalculator-2.6.jar
[INFO] Installing D:\Program Files\java\jdk1.7.0_07\bin\apache-maven-3.3.9\pom.x
ml to C:\Documents and Settings\Administrator\.m2\repository\BMI\BMI.BMICalculat
or\2.6\BMI.BMICalculator-2.6.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.938 s
[INFO] Finished at: 2016-04-08T01:28:39-07:00
[INFO] Final Memory: 7M/19M
[INFO] ------------------------------------------------------------------------
|

May 26th, 2016, 04:18 AM
|
Authorized User
|
|
Join Date: Mar 2012
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by muthukutta1
Hi
Thanks.However,on a methodical way,I was able to create a jar file for an application prg in java using the mvn.cmd command.
But it is empty one with the name 1.0SNAPSHOT.jar with maven-archiver folder ofcourse .Please let me know the correct command to make
maven create a fully exexcutable jar file
The first method was as below:
mvn.cmd archetype:generate -DarchetypeArtifactId=maven-archetype - webapp
The next usage was
mvn.cmd clean jar:jar
This resulted in target with jar as said above
Though the error is minor i the fixing for the creation of jar may be helpful contexually
As
muthukutta1
An example showing the jar file .How to make t executable
Thanks
Code:
mvn.cmd clean install
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for
com.lottery:Lottery:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-comp
iler-plugin is missing. @ line 21, column 17
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten t
he stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support buildin
g such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Lottery number generator: Good Luck 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Lottery ---
[INFO] Deleting D:\Program Files\java\jdk1.7.0_07\bin\apache-maven-3.3.9\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Lottery --
-
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Program Files\java\jdk1.7.0_07\bin
\apache-maven-3.3.9\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Lottery ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Lo
ttery ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Program Files\java\jdk1.7.0_07\bin
\apache-maven-3.3.9\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ Lottery
---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ Lottery ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ Lottery ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: D:\Program Files\java\jdk1.7.0_07\bin\apache-maven-3.3.9\ta
rget\Lottery.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ Lottery ---
[INFO] Installing D:\Program Files\java\jdk1.7.0_07\bin\apache-maven-3.3.9\targe
t\Lottery.jar to C:\Documents and Settings\Administrator\.m2\repository\com\lott
ery\Lottery\1.0-SNAPSHOT\Lottery-1.0-SNAPSHOT.jar
[INFO] Installing D:\Program Files\java\jdk1.7.0_07\bin\apache-maven-3.3.9\pom.x
ml to C:\Documents and Settings\Administrator\.m2\repository\com\lottery\Lottery
\1.0-SNAPSHOT\Lottery-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.859 s
[INFO] Finished at: 2016-02-16T01:31:03-08:00
[INFO] Final Memory: 8M/19M
[INFO] ------------------------------------------------------------------------
|
Hi
A sampler one for building war has been found to yield good result.Please help me to get this
war file to get executed
Thanks a lot
As
muthukutta1
Code:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>jvaranch-dibs</groupId>
<artifactId>dibs</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNASHOT</version>
<name>dibs Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>dibs</finalName>
</build>
</project>
mvn.cmd war:war
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building dibs Maven Webapp 0.0.1-SNASHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-cli) @ dibs ---
[INFO] Packaging webapp
[INFO] Assembling webapp [dibs] in [D:\Program Files\java\jdk1.7.0_07\bin\apache
-maven-3.3.9\dibs\target\dibs]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\Program Files\java\jdk1.7.0_07\bin\apache-ma
ven-3.3.9\dibs\src\main\webapp]
[INFO] Webapp assembled in [31 msecs]
[INFO] Building war: D:\Program Files\java\jdk1.7.0_07\bin\apache-maven-3.3.9\di
bs\target\dibs.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.875 s
[INFO] Finished at: 2016-05-19T07:55:11-07:00
[INFO] Final Memory: 6M/16M
[INFO] ------------------------------------------------------------------------
|

June 20th, 2016, 09:48 AM
|
Authorized User
|
|
Join Date: Mar 2012
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Maven in par with Java package
Quote:
Originally Posted by photoelectric
The archetype I have found to work for me creating projects similar to the code included with the book is the maven-archetype-webapp. One issue I have found though is that this archetype creates a project with a version 2.5 Deployment Descriptor (web.xml file), but the examples in the book use version 3.1. So after I create the project from the maven command line I change the web.xml file to the proper version before I import the project into Eclipse.
The archetype command is:
mvn archetype:generate -DarchetypeArtifactId=maven-archetype-webapp
|
Hi
How to put a class into a directory structure that matches the package hierarchy.using archetype generation method
Thanks
As
muthukutta1
|
|
 |