You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Ole Ersoy <ol...@yahoo.com> on 2006/12/03 19:02:12 UTC
More Test Results
Emmanuel,
I ran more tests and uploaded the document
with results, shell scripts, etc. to
my sandbox.
I'll paste it below as well.
QUICK SUMMARY:
Created a parent project, L0Project, with a
dependencyManagement section
with commons-utils version 2.11.
Create a child project, L1Project,
with a dependency on 3.2
and a test that loads
AbstractBagDecorator.
This runs fine.
(Emmanuel I could run
other combinations, but I think this should
cover all of them?)
HOWEVER - If you try to import
L1Project into eclipse, it
will not see the class path
to commons-utils 3.2.
CONCLUSION
Overriding dependencyManagement
seems to work fine inside Maven, but
the eclipse plugin needs to support it
as well.
OK - Here's the apt document with shell
scripts etc. that I ran for testing. It's also
in my sandbox here:
https://svn.apache.org/repos/asf/directory/sandbox/oersoy/maven-testing/eclipse-maven-testing.apt
------------------------------------------
Eclipse Maven
Testing
------------------------------------------
Challenge
See whether we can make a project
with packaging set to pom and
import it into eclipse.
Solution
Run the following script
----------------------------------------------------------------
mvn archetype:create -DartifactId=L0Project
-DgroupId=test
cd L0Project
sed -e 's/jar/pom/' pom.xml | sed -e '10,18d' >
pom.xml.tmp
cat << END >> pom.xml.tmp
<dependencyManagement>
<dependencies>
<dependency>
<artifactId>commons-collections</artifactId>
<groupId>commons-collections</groupId>
<version>2.11</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
END
mv pom.xml.tmp pom.xml
cd L0Project
mvn eclipse:eclipse
----------------------------------------------------------------
Result
The script runs fine, but
the eclipse plugin does
did not create an eclipse
importable project, and it
tells us that it does not
like this:
Not running eclipse plugin goal for pom project.
Follow Up
Hopefully there is a way
to switch this so that it
does. It would have been
really nice for editing
the dependencyManagement
section of a parent pom.
I'll check on Maven Users
to see whether anyone knows
how.
Challenge
See whether we can set
a dependency version in
the dependency management
section of a pom and then
override it on a child pom.
Solution
Run the following script
----------------------------------------------------------------
mvn archetype:create -DartifactId=L0Project
-DgroupId=test
cd L0Project
sed -e 's/jar/pom/' pom.xml | sed -e '10,18d' >
pom.xml.tmp
cat << END >> pom.xml.tmp
<dependencyManagement>
<dependencies>
<dependency>
<artifactId>commons-collections</artifactId>
<groupId>commons-collections</groupId>
<version>2.11</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
END
mv pom.xml.tmp pom.xml
mvn archetype:create -DartifactId=L1Project
-DgroupId=test
pushd L1Project
sed -e '20,21d' pom.xml > pom.xml.tmp
cat << END >> pom.xml.tmp
<dependency>
<artifactId>commons-collections</artifactId>
<groupId>commons-collections</groupId>
<version>3.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
END
mv pom.xml.tmp pom.xml
pushd src/test/java/test
cat << END > AppTest.java
package test;
import
org.apache.commons.collections.bag.AbstractBagDecorator;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
AbstractBagDecorator emannuelsBagDecorator;
assertTrue( true );
}
}
END
popd
popd
mvn eclipse:eclipse
mvn test
----------------------------------------------------------------
Result
The test runs fine.
Challenge
See whether we can import the
L1Project into eclipse and have
the AbstractBagDecorator that the
AppTest needs loaded successfully.
Solution
Import the L1Project into
eclipse.
Result
The AbstractBagDecorator
does not load.
Follow Up
Check with Maven Dev to see
whether this is a known bug.
____________________________________________________________________________________
Have a burning question?
Go to www.Answers.yahoo.com and get answers from real people who know.