Re: having problems with java -cp taget command

2011-12-18 Thread Matt Narrell
Is this class in your jar?

On Dec 18, 2011, at 1:02 PM, Apache Omega  wrote:

> with 'o'
>
>
>
> 
> From: Robert Scholte [via Maven] 
> To: Apache Omega 
> Sent: Sunday, December 18, 2011 2:21 PM
> Subject: RE: having problems with java -cp taget command
>
>
>
> Is Jason with or without 'o'?
>
>
>
>
>> Date: Sun, 18 Dec 2011 12:15:53 -0800
>> From: [hidden email]
>> To: [hidden email]
>> Subject: Re: having problems with java -cp taget command
>>
>> I tried it again and it still gives me the same error I copied the code and 
>> this is what it says
>>
>> I just don't understand this problem
>>
>> ---
>> T E S T S
>> ---
>> Running org.JasonThomas.ShadowInnovations.AppTest
>> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.013 sec
>>
>> Results :
>>
>> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
>>
>> [INFO]
>> [INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ MavenTest ---
>> [INFO] Building jar: C:\Program 
>> Files\apache-maven-3.0.3\my-app\joker\MavenTest\
>> target\MavenTest-1.0-SNAPSHOT.jar
>> [INFO] 
>> 
>> [INFO] BUILD SUCCESS
>> [INFO] 
>> 
>> [INFO] Total time: 3.000s
>> [INFO] Finished at: Sun Dec 18 14:10:07 CST 2011
>> [INFO] Final Memory: 12M/104M
>> [INFO] 
>> 
>> C:\Program Files\apache-maven-3.0.3\my-app\joker\MavenTest>java -cp 
>> target/Maven
>> Test-1.0-SNAPSHOT.jar org.JasonThomas.ShadowInnovations
>> Error: Could not find or load main class org.JasonThomas.ShadowInnovations
>>
>> C:\Program Files\apache-maven-3.0.3\my-app\joker\MavenTest>
>>
>>
>>
>> 
>> From: Robert Scholte [via Maven] <[hidden email]>
>> To: Apache Omega <[hidden email]>
>> Sent: Sunday, December 18, 2011 1:21 PM
>> Subject: RE: having problems with java -cp taget command
>>
>>
>>
>>
>> This problem has nothing to do with Maven, it's java basics.
>>
>> First of all, you shouldn't look under src/main/java, this is not on the 
>> classpath. You should look in the jar.
>>
>> The real problem is a typo:
>>
>> org.JasnThomas.ShadowInnovations
>>
>> org.JasonThomas.ShadowInnovations
>>
>>
>>
>> see the difference?
>>
>>
>>
>> -Robert
>>
>>
>>
>> ps. try to keep packagenames lowercase.
>>
>>
>>
>>> Date: Sun, 18 Dec 2011 11:14:20 -0800
>>> From: [hidden email]
>>> To: [hidden email]
>>> Subject: having problems with java -cp taget command
>>>
>>> I've worked out some kinks just to find another kink
>>> i entered (java -cp target/MavenTestApp-1.0-SNAPSHOT.jar
>>> org.JasnThomas.ShadowInnovations) and the message i got was could not find
>>> or load main class org.JasonThomas.ShadowInnovations and the folder is
>>> clearly in the right path
>>> src/main/java/org/JasonThomas/ShadowInnovations/App.java
>>>
>>> how is this possible when the folder is clearly there
>>>
>>> p.s. sorry i'm posting so much I'm just trying to get started quickly -
>>> losing time on actually programing messing around with all this but i gotta
>>> learn it.
>>>
>>>
>>> --
>>> View this message in context: 
>>> http://maven.40175.n5.nabble.com/having-problems-with-java-cp-taget-command-tp5084317p5084317.html
>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>
>>> -
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>> -
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>>
>> 
>>
>> If you reply to this email, your message will be added to the discussion 
>> below:http://maven.40175.n5.nabble.com/having-problems-with-java-cp-taget-command-tp5084317p5084324.html
>> To unsubscribe from having problems with java -cp taget command, click here.
>> NAML
>>
>> --
>> View this message in context: 
>> http://maven.40175.n5.nabble.com/having-problems-with-java-cp-taget-command-tp5084317p5084424.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.  
>>
>> -
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>
> 
>
> If you reply to this email, your message will be added to the discussion 
> below:http://maven.40175.n5.nabble.com/having-problems-with-java-cp-taget-command-tp5084317p5084433.html
> To unsubscribe from having problems with java -cp taget command, click here.
> NAML
>
> --
> View this message in context: 
> http://maven.40175.n5.nabble.com/having-problems-with-java-cp-taget-command-tp508

Re: having problems with java -cp taget command

2011-12-18 Thread Matt Narrell
Where is the code?

On Dec 18, 2011, at 2:46 PM, Apache Omega  wrote:

> yes its in there I'm just totally confused right now hers everything i did
>
> when I run java -cp target\TestAppTest-1.0-SNAPSHOT.jar
> (and then)org.jason.ShadowInnovations.App (that didnt work [Error: Could not 
> find or load main class jar] so I put
> in)org.jason.ShadowInnovations.AppTest (and i got [Error: Could not find or 
> load main class]
>
> but this is in my POM
> - 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";>
> 4.0.0
> org.jason.ShadowInnovations
> TestAppTest
> 1.0-SNAPSHOT
> jar
> TestAppTest
> http://maven.apache.org
> - 
> UTF-8
> 
> - 
> - 
> junit
> junit
> 3.8.1
> test
> 
> 
> 
>
> This is my code
>
>
> ---
> T E S T S
> ---
> Running org.jason.ShadowInnovations.AppTest
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
>
> Results :
>
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
>
> [INFO]
> [INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ TestAppTest ---
> [INFO] Building jar: C:\Program 
> Files\apache-maven-3.0.3\my-app\stupid\TestAppTe
> st\target\TestAppTest-1.0-SNAPSHOT.jar
> [INFO] 
> 
> [INFO] BUILD SUCCESS
> [INFO] 
> 
> [INFO] Total time: 2.798s
> [INFO] Finished at: Sun Dec 18 16:03:33 CST 2011
> [INFO] Final Memory: 11M/104M
> [INFO] 
> 
> C:\Program Files\apache-maven-3.0.3\my-app\stupid\TestAppTest>java -cp 
> target\Te
> stAppTest-1.0-SNAPSHOT. jar org.jason.ShadowInnovations.App
> Error: Could not find or load main class jar
>
>
>
> C:\Program Files\apache-maven-3.0.3\my-app\stupid\TestAppTest>java -cp 
> target\Te
> stAppTest-1.0-SNAPSHOT.jar org.jason.ShadowInnovations.AppTest
> Error: Could not find or load main class org.jason.ShadowInnovations.AppTest
>
> C:\Program Files\apache-maven-3.0.3\my-app\stupid\TestAppTest>
>
>
> 
> From: Matt Narrell [via Maven] 
> To: Apache Omega 
> Sent: Sunday, December 18, 2011 3:34 PM
> Subject: Re: having problems with java -cp taget command
>
>
> Is this class in your jar?
>
> On Dec 18, 2011, at 1:02 PM, Apache Omega <[hidden email]> wrote:
>
>
>> with 'o'
>>
>>
>>
>> 
>> From: Robert Scholte [via Maven] <[hidden email]>
>> To: Apache Omega <[hidden email]>
>> Sent: Sunday, December 18, 2011 2:21 PM
>> Subject: RE: having problems with java -cp taget command
>>
>>
>>
>> Is Jason with or without 'o'?
>>
>>
>>
>>
>>> Date: Sun, 18 Dec 2011 12:15:53 -0800
>>> From: [hidden email]
>>> To: [hidden email]
>>> Subject: Re: having problems with java -cp taget command
>>>
>>> I tried it again and it still gives me the same error I copied the code and 
>>> this is what it says
>>>
>>> I just don't understand this problem
>>>
>>> ---
>>> T E S T S
>>> ---
>>> Running org.JasonThomas.ShadowInnovations.AppTest
>>> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.013 sec
>>>
>>> Results :
>>>
>>> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
>>>
>>> [INFO]
>>> [INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ MavenTest ---
>>> [INFO] Building jar: C:\Program 
>>> Files\apache-maven-3.0.3\my-app\joker\MavenTest\
>>> target\MavenTest-1.0-SNAPSHOT.jar
>>> [INFO] 
>>> 
>>> [INFO] BUILD SUCCESS
>>> [INFO] 
>>> 
>>> [INFO] Total time: 3.000s
>>> [INFO] Finished at: Sun Dec 18 14:10:07 CST 2011
>>> [INFO] Final Memory: 12M/104M
>>> [INFO] 
>>> 
>>> C:\P

Re: Howto access project version programmatically within application

2012-01-11 Thread Matt Narrell
Agreed.

I filter-copy a properties file with the following:

project.name=${project.name}
project.version=${project.version}
build.date=${build.date}
...

Then I can load this file and have at it.

matt

On Jan 11, 2012, at 7:48 AM, Mark H. Wood wrote:

> On Wed, Jan 11, 2012 at 09:07:29AM -0600, Steve Cohen wrote:
>> It appears that this entire class and the interface it is based on are 
>> deprecated, in favor of org.apache.maven.rtinfo.RuntimeInformation and 
>> org.apache.maven.rtinfo.internal.DefaultRuntimeInformation.
>> 
>> But this non-deprecated version of the interface/impl REMOVE the 
>> getApplicationVersion() method.
>> 
>> What's going on here and what is the approved method for getting the 
>> application version now?
> 
> What he said.
> 
> Dunno about *approved*, but in a JAR (or WAR?) in
> META-INF/maven/${groupId}/${artifactId} you'll find pom.properties
> which contains a 'version' property:
> 
>  $ cat pom.properties 
>  #Generated by Maven
>  #Mon Aug 29 13:19:24 EDT 2011
>  version=1.0-SNAPSHOT
>  groupId=edu.iupui.ulib.dspace
>  artifactId=casAuthn
> 
> I know that at least one product deserializes this file to discover
> its own version number.
> 
> One could use resource filtering to produce a customized
> allAboutMe.properties explicitly, containing anything Maven knows and
> is willing to provide to a filter.
> 
> But I too would like to know what the supported method is, and where
> that is documented.
> 
> -- 
> Mark H. Wood, Lead System Programmer   mw...@iupui.edu
> Asking whether markets are efficient is like asking whether people are smart.


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: Maven - offer anything for runtime?

2012-04-28 Thread Matt Narrell
You can also use the maven-enforcer-plugin to identify dependencies
that attempt to bring in older versions of transitive dependencies.

On Apr 28, 2012, at 10:55 AM, Ron Wheeler
 wrote:

> It is not that hard.
> You just paste the same exclusion into each POM that includes something that 
> brings in a version that you do not want.
>
> To reduce the effort, make your POMs that produce artifacts that you deploy 
> depend on your own POMs that only serve to bring in third party tools.
> In that way the developer does not have to do any exclusions since your 
> library POMs have already setup the third party dependencies correctly.
>
> mywar.pom depends on myapache.pom and myspring.pom and myjasper.pom.
> myapache.pom and myspring.pom and myjasper.pom are sanitized to get rid of  
> transitive dependencies that I will provide at run-time.
>
> Makes the job very simple
> Once you do it once the developers have a much simpler life.
>
> Ron
>
> On 27/04/2012 5:47 PM, J.V. wrote:
>> If I have a log4j exclusion in every  section, that would look 
>> quite messy.  Is there a way to globally do this?
>> We have dozens of dependencies, just looks like there would be an easier 
>> way.  Nearly everything depends on log4j so that is a lot of work to add to 
>> every dependency.  Not sure there is an easier way though.
>>
>> J.V.
>>
>> On 4/27/2012 1:44 PM, Ron Wheeler wrote:
>>> You can either be god-like or trust that Tomcat will be.
>>> You only need to do it once.
>>> It takes a bit of time but, at the end, you know what you are running in 
>>> production and developers don't have to worry about getting a 
>>> MethodNotFound at run-time.
>>>
>>> It is not as bad as you think if you have a good IDE with Maven support. We 
>>> use Eclipse STS from Springframework.
>>>
>>> It will look through your project POM and tell you where all your 
>>> dependencies are coming from.
>>>
>>> You can then write excludes on your dependencies to stop them from bringing 
>>> in transitive dependencies that you do not want.
>>>
>>> We made our own poms to bring in all the Apache stuff (commons-xxx, log4j, 
>>> etc.) so we had a single dependency that developers could use in their 
>>> projects to get the "right" version of all the "right" Apache libraries. 
>>> They never had to worry about them again and if we wanted to upgrade log4j, 
>>> we just did it in one place.
>>> For third party libraries that had transitive dependencies on something 
>>> like log4j, we just added an exclude to their dependency specification.
>>>
>>> We had a small team with a lot of modules so it really made everyone's life 
>>> easier and I did not have to worry that someone would inject an old version 
>>> into the system.
>>>
>>> Ron
>>>
>>>
>>> On 27/04/2012 3:27 PM, J.V. wrote:


 On 4/27/2012 10:04 AM, Ron Wheeler wrote:
> On 27/04/2012 11:40 AM, J.V. wrote:
>> I understand how Maven resolves dependencies (and transitive 
>> dependencies) at compile time, but does it bring anything to the table 
>> at run time?
> It makes your artifacts that your run-time environment will execute.
> It is a build tool.
>>
>> For example, if I have in my application dependency list two versions of 
>> log4J (let's say version 8 and version 15), will I deploy both 
>> jars/version along with my app on say a tomcat server inside the war?
> Fix it so you only have 1.
> Settle on the "right" versions of third party libraries and use 
> "exclusions" in your dependencies to prevent other libraries from 
> grabbing older versions.
=> this is a very tedious task.  I have to be godlike to know the 
 transitive dependencies and what libraries they use, and inspect my local 
 repository, find out all dups of everything, find out which top level 
 dependency needs it and go exclude this.  This is a maintenance nightmare.
> Most software is upwards compatible so you will very seldom have any 
> trouble.
> For log4j, you want to specify the latest version.
>
>>
>> At runtime which one does it choose?  If I am executing the code that 
>> depends on version 8, how would the correct jar be in the classpath at 
>> that point and later log4J version 15 be in my classpath when code that 
>> has that dependency executes?
>>
> The runtime behaviour depends on the environment (Tomcat).
> If you have 2 possible versions available, it will pick one based on how 
> the programmers who wrote the environment thought that the world should 
> work and in Tomcats case, what order the webapps started when the server 
> came up which is not in your control.
>
> This can lead to MethodNotFound exceptions at runtime where someone calls 
> a method that is available in Version 15 but your environment picked 8 to 
> load.
> Don't give it the choice.
>
>
>> At runtime, Maven is out of the picture correct?  This is a missing