james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernd Waibel <BWai...@intarsys.de>
Subject AW: james-server pom.xml missing scope test [unsigned]
Date Mon, 21 Mar 2016 15:23:56 GMT
Hi Matthieu,

thanks for the nice response. I would like to follow the discussion.

At first I just had a look at the pom.xml of the server project, searching to solve my maven
problems.
Only cassandra and elasticsearch do define test-jar without scope.
All other test-jars have the <scope>test</scope>.
So I thought: all projects should use this pattern. 
I think that the maven <scope>test</scope> defines the parts of an project, which
should be used inside a phase "test", for testing an application. But not inside a phase "publish"
or "compile" (except compile-test).

At second there is another thing I do not understand:
In the pom.xml of the james-server and in 
    <artifactId>apache-james-mailbox-elasticsearch</artifactId>
there is a dependency 
                <dependency>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                    <scope>test</scope>
                </dependency>
Here you used the test scope.
But this "junit" dependency is needed to compile the test-jar of elasticsearch inside server/pom.xml.
Defining the test-jar without any scope leads to the fact, that compiling the server will
fail inside the compile phase, as missing the junit (and others), cause junit is not defined
inside the compile phase.
Is this correct? Remember: I am not a maven expert. ;-)
Shouldn't every "test" dependencies use the same <scope>?

At third, I had a look on this because we need to deploy it. That is the "architecture" side
of this question. When deploying an application, I like it small. So we try to get rid of
"debug" and "test" code, if we push our product to our customers. They will never need to
test or debug "our" application.
So I like it to have a "test" deployment, and a "runtime" deployment.
The maven-scope test defines this behavior.

At last, the problem which caused the question:
I just could not get the "james-server" to compile. Not inside eclipse.
One reason is, that some test-classes won't compile.
This is currently a "managesieve" error, exactly, not a elasticsearch problem, as I did find
out.
But test-classes should not be critical for running James (IMO).
But currently it is, because James won't run without test-classes.
So the test-classes may be a show-stopper.

As I understand, maven will currently use the <test-jar> dependency, if running through
the package phase of james-server, cause it does not have any scope.
The -Dskiptests will not work, cause the artifact is not of scope test.
Furthermore the test-jar is not available on the apache repo https://repository.apache.org/content/groups/snapshots/org/apache/james/
It should be.
But that is another problem.

Currently I just comment out all test-jar directives in server/pom.xml, to get maven to package
my james server. This is ok for me. But I just like to understand.


Just my part of thoughts, and not worth a jira ticket.
Bernd



-----Ursprüngliche Nachricht-----
Von: Matthieu Baechler [mailto:mbaechler@linagora.com] 
Gesendet: Montag, 21. März 2016 14:07
An: server-dev@james.apache.org
Betreff: Re: james-server pom.xml missing scope test [unsigned]

Hi Bernd,

I don't really agree with you.

This dependency is part of dependencyManagement of server/pom.xml.

It only defines a version for projects willing to depend on this artifact.

We usually don't put the scope into dependencyManagement because it's 
each project's responsibility to decide what to include.

In the end, we have projects that are tests with sources into 
src/main/java because we create a "jar" to execute them against an imap 
server.

Feel free to argue about why we should put scope in dependencyManagement 
instead of dependencies, we'll read you with care !

Cheers,

-- 
Matthieu Baechler

On 18/03/2016 22:35, Bernd Waibel wrote:
> Hello together
>
> The pom.xml of
>      <name>Apache James :: Server</name>
> does declare
>              <dependency>
>                  <groupId>org.apache.james</groupId>
>                  <artifactId>apache-james-mailbox-elasticsearch</artifactId>
>                  <version>${mailbox.version}</version>
>                  <type>test-jar</type>
>              </dependency>
> A "test-jar" should have a "<scope>test</scope". Or not?
>
> Could the maintainer for "elasticsearch" please fix the pom.xml?
>
>
>
> Greetings
>
> Bernd
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message