Re: adding the classpath to jar file

2007-06-26 Thread Jan-Christopher Bals

You have to provide log4j via the classpath on your own.
Maven does include log4j in your generated jar automatically.

But Maven can generate the classpath for you
http://maven.apache.org/plugins/maven-dependency-plugin/usage.html
-dependency:build-classpath


2007/6/26, DCVer [EMAIL PROTECTED]:



Hi,

I'm creating a jar using mvn package. The files, which are included in
this jar are using another jar (e.g. log4j-1.2.14.jar), which are stored
in
maven repository. My part of pom.xml file responsible for dependencies
looks
like:

dependency
  groupIdlog4j/groupId
  artifactIdlog4j/artifactId
  version1.2.14/version
  scopecompile/scope
  typejar/type
/dependency

The mvn package process finishes correctly, but when i run the jar
using:

java -cp target\my-app-1.0-SNAPSHOT.jar com.mycompany.app.App

i receive the error:

Exception in thread main java.lang.NoClassDefFoundError:
org/apache/log4j/Logger

(on line:
private static Logger logger = Logger.getLogger(com.mycompany.app.App);

In my opinion the jar, that was created using mvn package doesn't know
about dependencies (and about jars stored in repository?). How should I
set
classpaths and make this jar work correctly? Isn't it a BASIC
functionality,
that Maven2 should do, when I set dependency in pom.xml file?

I tried this with other jars (in repository) and other methods of the
classes included in jars and the results were exactly the same.
--
View this message in context:
http://www.nabble.com/adding-the-classpath-to-jar-file-tf3982263s177.html#a11305225
Sent from the Maven - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: adding the classpath to jar file

2007-06-26 Thread Jan-Christopher Bals

Yes. The behavior is correct.

Maven does not include the log4j jar because jars cannot contain other jars.

When you use additional jars at runtime, you have to provide them via the
classpath.

And as far as i know you cannot define the classpath of jar inside the jar
like the main class.

So maven cannot set the classpath for you. Moreover Maven cannot know where
the jar is executed, so it cannot guarantee that the referenced jars in the
classpath are present.

2007/6/26, DCVer [EMAIL PROTECTED]:



Thanks for reply.

Hmm, I think my jar doesn't contain log4j - it only contains App.class and
pom.xml with pom.properties and manifest.mf. Is it a correctly built jar?

And I wonder why Maven2 won't set *somewhere* classpaths to jars on its
own
if it knows where they are :-/


Jan-Christopher Bals-2 wrote:

 You have to provide log4j via the classpath on your own.
 Maven does include log4j in your generated jar automatically.

 But Maven can generate the classpath for you
 http://maven.apache.org/plugins/maven-dependency-plugin/usage.html
 -dependency:build-classpath


 2007/6/26, DCVer [EMAIL PROTECTED]:


 Hi,

 I'm creating a jar using mvn package. The files, which are included
in
 this jar are using another jar (e.g. log4j-1.2.14.jar), which are
stored
 in
 maven repository. My part of pom.xml file responsible for dependencies
 looks
 like:

 dependency
   groupIdlog4j/groupId
   artifactIdlog4j/artifactId
   version1.2.14/version
   scopecompile/scope
   typejar/type
 /dependency

 The mvn package process finishes correctly, but when i run the jar
 using:

 java -cp target\my-app-1.0-SNAPSHOT.jar com.mycompany.app.App

 i receive the error:

 Exception in thread main java.lang.NoClassDefFoundError:
 org/apache/log4j/Logger

 (on line:
 private static Logger logger = Logger.getLogger(com.mycompany.app.App
);

 In my opinion the jar, that was created using mvn package doesn't
know
 about dependencies (and about jars stored in repository?). How should I
 set
 classpaths and make this jar work correctly? Isn't it a BASIC
 functionality,
 that Maven2 should do, when I set dependency in pom.xml file?

 I tried this with other jars (in repository) and other methods of the
 classes included in jars and the results were exactly the same.
 --
 View this message in context:

http://www.nabble.com/adding-the-classpath-to-jar-file-tf3982263s177.html#a11305225
 Sent from the Maven - Users mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





--
View this message in context:
http://www.nabble.com/adding-the-classpath-to-jar-file-tf3982263s177.html#a11305662
Sent from the Maven - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Surefire 2.4-SNAPSHOT errors

2007-06-01 Thread Jan-Christopher Bals

-- Forwarded message --
From: Jan-Christopher Bals [EMAIL PROTECTED]
Date: 01.06.2007 10:03
Subject: Re: Surefire 2.4-SNAPSHOT errors
To: Maven Users List users@maven.apache.org

Hi!

I have got the same problem.

Can anyone fix the pom?

[WARNING] POM for
'org.apache.maven.surefire:surefire-booter:pom:2.4-SNAPSHOT:runtime' is
invalid. It will be ignored for artifact resolution. Reason: Failed to
validate POM

Jan


2007/5/31, mhargus [EMAIL PROTECTED]:



I'm getting an error during during the test compile phase after running
'mvn
install'.  I'm using the 2.4-SNAPSHOT version of Surefire, and it just
started blowing up on me today.


Here a snippet of the error:


[WARNING] POM for
'org.apache.maven.surefire:surefire-booter:pom:2.4-SNAPSHOT:runtime' is
invalid. It will be ignored for artifact resolution. Reason: Failed to
validate POM
-
this realm =
app0.child-container[org.apache.maven.plugins:maven-surefire-plugin]
urls[0] =

file:/Users/matt/.m2/repository/org/apache/maven/plugins/maven-surefire-plugin/2.4-SNAPSHOT/maven-
surefire-plugin-2.4-SNAPSHOT.jar
urls[1] =

file:/Users/matt/.m2/repository/org/apache/maven/surefire/surefire-booter/2.4-SNAPSHOT/surefire-
booter-2.4-SNAPSHOT.jar
urls[2] =
file:/Users/matt/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-
utils-1.1.jar
Number of imports: 4
import: [EMAIL PROTECTED]
import: [EMAIL PROTECTED]
import: [EMAIL PROTECTED]
import: [EMAIL PROTECTED]


this realm = plexus.core
urls[0] = file:/usr/local/maven/lib/maven-core-2.0.6-uber.jar
Number of imports: 4
import: [EMAIL PROTECTED]
import: [EMAIL PROTECTED]
import: [EMAIL PROTECTED]
import: [EMAIL PROTECTED]
-
[INFO]

[ERROR] BUILD ERROR
[INFO]

[INFO] Internal error in the plugin manager executing goal
'org.apache.maven.plugins:maven-surefire-plugin:2.4-SNAPSHOT:test ':
Unable
to find the mojo
'org.apache.maven.plugins:maven-surefire-plugin:2.4-SNAPSHOT:test' in the
plugin 'org.apache.maven.plugins:maven-surefire-plugin'
org/apache/maven/surefire/util/NestedCheckedException

Anyone else seeing this?

Matt
--
View this message in context: 
http://www.nabble.com/Surefire-2.4-SNAPSHOT-errors-tf3847995s177.html#a10898921

Sent from the Maven - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Surefire 2.4-SNAPSHOT errors

2007-06-01 Thread Jan-Christopher Bals

Hi!

I have got the same problem.

Can anyone fix the pom?

[WARNING] POM for
'org.apache.maven.surefire:surefire-booter:pom:2.4-SNAPSHOT:runtime' is
invalid. It will be ignored for artifact resolution. Reason: Failed to
validate POM

Jan


2007/5/31, mhargus [EMAIL PROTECTED]:



I'm getting an error during during the test compile phase after running
'mvn
install'.  I'm using the 2.4-SNAPSHOT version of Surefire, and it just
started blowing up on me today.


Here a snippet of the error:


[WARNING] POM for
'org.apache.maven.surefire:surefire-booter:pom:2.4-SNAPSHOT:runtime' is
invalid. It will be ignored for artifact resolution. Reason: Failed to
validate POM
-
this realm =
app0.child-container[org.apache.maven.plugins:maven-surefire-plugin]
urls[0] =

file:/Users/matt/.m2/repository/org/apache/maven/plugins/maven-surefire-plugin/2.4-SNAPSHOT/maven-
surefire-plugin-2.4-SNAPSHOT.jar
urls[1] =

file:/Users/matt/.m2/repository/org/apache/maven/surefire/surefire-booter/2.4-SNAPSHOT/surefire-
booter-2.4-SNAPSHOT.jar
urls[2] =

file:/Users/matt/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-
utils-1.1.jar
Number of imports: 4
import: [EMAIL PROTECTED]
import: [EMAIL PROTECTED]
import: [EMAIL PROTECTED]
import: [EMAIL PROTECTED]


this realm = plexus.core
urls[0] = file:/usr/local/maven/lib/maven-core-2.0.6-uber.jar
Number of imports: 4
import: [EMAIL PROTECTED]
import: [EMAIL PROTECTED]
import: [EMAIL PROTECTED]
import: [EMAIL PROTECTED]
-
[INFO]

[ERROR] BUILD ERROR
[INFO]

[INFO] Internal error in the plugin manager executing goal
'org.apache.maven.plugins:maven-surefire-plugin:2.4-SNAPSHOT:test': Unable
to find the mojo
'org.apache.maven.plugins:maven-surefire-plugin:2.4-SNAPSHOT:test' in the
plugin 'org.apache.maven.plugins:maven-surefire-plugin'
org/apache/maven/surefire/util/NestedCheckedException

Anyone else seeing this?

Matt
--
View this message in context:
http://www.nabble.com/Surefire-2.4-SNAPSHOT-errors-tf3847995s177.html#a10898921
Sent from the Maven - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




[m2] execute different testng suites in different phases

2006-11-03 Thread Jan-Christopher Bals

Hi folks!

I'm trying to execute TestNG Suites in different maven2 phases.

For that i defined two different testng.xml files

a) unit-tests.xml
b) integration-tests.xml

Now i want surefire to execute the unit-tests in the test phase and the 
integration-tests in the integration-test phase.


So i added the following lines to my pom:

build
...
 plugins

  plugin

   artifactIdmaven-surefire-plugin/artifactId

   configuration

suiteXmlFiles

 suiteXmlFilesrc/test/resources/unit-tests.xml/suiteXmlFile

/suiteXmlFiles

   /configuration

  /plugin

  plugin

   artifactIdmaven-surefire-plugin/artifactId

   executions

execution

 idintegration-test/id

 phaseintegration-test/phase

 goals

  goaltest/goal

 /goals

 configuration

  suiteXmlFiles

   suiteXmlFileintegration-tests.xml/suiteXmlFile 



  /suiteXmlFiles

 /configuration

/execution

   /executions

  /plugin

 /plugins
   ...
/build

When i run 'mvn test' surefire executes the unit tests as desired.
But when i run 'mvn integration-test' surefire does not execute the 
integration-tests in the integration-phase. Instead of that it runs the 
unit-tests a second time!



Does anybody know how to execute testng suites in different maven phases?

best regards
Jan

P.S.

build
...
 plugins
  plugin
   artifactIdmaven-surefire-plugin/artifactId
   executions
execution
 idtest/id
 phasetest/phase
 goals
  goaltest/goal
 /goals
 configuration
  suiteXmlFiles
   suiteXmlFileunit-tests.xml/suiteXmlFile
  /suiteXmlFiles
 /configuration
/execution
execution
 idintegration-test/id
 phaseintegration-test/phase
 goals
  goaltest/goal
 /goals
 configuration
  suiteXmlFiles
   suiteXmlFileintegration-tests.xml/suiteXmlFile 


  /suiteXmlFiles
 /configuration
/execution

   /executions
  /plugin
 /plugins
   ...
/build

This does not work, too. In this case surefire runs the unit and the 
integration tests in the test phase, which is even worse for me.





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



custom archetype : filtering directory names

2006-10-18 Thread Jan-Christopher Bals

Hi!

I am currently building a custom archetype.

In addition to the replacement of ${keys} in files i need a way to 
rename files and directories.


Example:

archetype
|-- pom.xml
`-- src
`-- main
`-- resources
|-- META-INF
|   `-- archetype.xml
`-- archetype-resources
|-- pom.xml
`-- src
`-- main
`-- java
`-- ${packagename}
`--${classname}.java



Is there a way to achieve replacements like that?

best regards

Jan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Maven2 :: custom archetype :: filtering of resources

2006-09-20 Thread Jan-Christopher Bals

Hi!

I just created my own maven2 archetype for building webapps with a set 
of default files (binary files like jpg, text files like xml).


I added these files in the archetype.xml description file.

archetype
  idobs-web-app/id
  sources
...
  /sources
  resources
resourcesrc/main/resources/config.xml/resource
...
  /resource

/archetype

When i try to create an new project via my own obs-web-app archetype, 
maven tries to replace expression like ${property} in the resource files.


[WARNING] org.apache.velocity.runtime.exception.ReferenceException: 
reference : template = archetype-resources/src/main/resources/config.xml 
[line 16,column 32] : ${property} is not a valid reference.




So here is my question:

Is there any way to exclude these files from filtering?

Jan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]