From issues-return-135826-archive-asf-public=cust-asf.ponee.io@maven.apache.org Wed Aug 1 09:18:04 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 00034180634 for ; Wed, 1 Aug 2018 09:18:03 +0200 (CEST) Received: (qmail 86559 invoked by uid 500); 1 Aug 2018 07:18:03 -0000 Mailing-List: contact issues-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list issues@maven.apache.org Received: (qmail 86548 invoked by uid 99); 1 Aug 2018 07:18:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Aug 2018 07:18:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 87129C1F24 for ; Wed, 1 Aug 2018 07:18:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id hPcfS5byP0sD for ; Wed, 1 Aug 2018 07:18:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 1B6915F125 for ; Wed, 1 Aug 2018 07:18:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 4E403E13DA for ; Wed, 1 Aug 2018 07:18:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 0D16E2775D for ; Wed, 1 Aug 2018 07:18:00 +0000 (UTC) Date: Wed, 1 Aug 2018 07:18:00 +0000 (UTC) From: "Karl Heinz Marbaise (JIRA)" To: issues@maven.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (MNG-6442) Run tests with Maven on pre-compiled project MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/MNG-6442?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D165648= 69#comment-16564869 ]=20 Karl Heinz Marbaise commented on MNG-6442: ------------------------------------------ After rereading this I have a question: If I re-compiled everywhere I fear = I might introduce errors unwittingly...=20 This can simply prevented by using a version control tool ? If you compile = always the same state it's not a problem..for example using Jenkins pipelin= es building on different nodes and/or different JDK's? The Maven project is= doing it exactly that...Just as an example: https://builds.apache.org/view= /M-R/view/Maven/job/maven-box/job/maven-acr-plugin/job/master/ runs on diff= erent OS's and different JDK's ? And yes it recompiles the code... Furthermore running unit tests from a compiled jar/module might not be the = correct way cause in pre JDK9 era that might be ok (Questioning the idea of= unit tests?) but starting with Modules this will not work anymore cause un= it tests often access/test internals which are not open for usage based on = {{module-info}}. and for this it is needed to run them before packaging the= m into a jar... > Run tests with Maven on pre-compiled project > -------------------------------------------- > > Key: MNG-6442 > URL: https://issues.apache.org/jira/browse/MNG-6442 > Project: Maven > Issue Type: Wish > Components: Artifacts and Repositories, Dependencies > Affects Versions: 3.5.2 > Environment: Linux, Windows > Reporter: Lasse Westh-Nielsen > Priority: Minor > > Hello, > This is not so much a bug as it is a support request. The mailing list li= nk was out of order. Please do triage into the right category. > I tried my luck on Stack Overflow (https://stackoverflow.com/questions/51= 079816/run-tests-with-maven-on-pre-compiled-project), but got nothing, and = I really need some direction. > Here is what I wrote on SO: > _Using Maven, I want to run unit and integration tests on a pre-compiled/= pre-jar'ed multi-module project. I am finding this exceedingly difficult._ > _My business case is, I want to compile and jar up a multi-module Maven p= roject in one place, and then have the unit test and integration tests run = using different Java versions and on different operating systems, to check = for compatibility. Let's just say \{Java 8, Java 10} x \{Ubuntu, Windows} t= o keep it simple._ > _The reason I want to compile and jar up in one pace is, I want to ensure= that I run tests on the actual code getting shipped. If I re-compiled ever= ywhere I fear I might introduce errors unwittingly._ > _One solution is to do=C2=A0{{mvn deploy -DaltDeploymentRepository=3D$myd= ir}}=C2=A0on Ubuntu to produce a compiled project tree and a directory full= of jars; then zipping up the project tree and deploy directory and shippin= g them off to a Windows machine; and there running=C2=A0{{mvn surefire:test= -Dmaven.repo.local=3D$mydir}}=C2=A0on the project tree._ > _That works but it is hella clumsy. Surefire seems to read the test class= es in the project tree and use the classes in the same project + jar depend= encies from the deployment repo to link against. A problem there is, with= =C2=A0{{-Dmaven.repo.local}}=C2=A0Maven needs to download all 3rd party dep= endencies again because that repo only contains my project artifacts. So a = solid solution, but not great._ > _Instead what I have been trying to do is, just use the compiled project = tree:_ > * _If I just do=C2=A0{{mvn surefire:test}}=C2=A0I get problems resolving= dependencies_ > * _I have tried=C2=A0{{mvn compile -Dmaven.main.skip surefire:test}}=C2= =A0to fix dependency resolution, which seems to work - just not for test de= pendencies_ > * _I further tried=C2=A0{{mvn compile -Dmaven.main.skip test-compile -Dm= aven.test.skip surefire:test}}, but for some reason that also does not work= , the build again fails trying to resolve test dependencies._ > _Interestingly, it is not deterministic, the failures happen at different= stages and sometimes not at all - I get the occasional green build!_ > _And now I am at my wits' end: I keep thinking this should be simple, and= that I can't possible be the first person struggling with this simple prob= lem._ > _It is opaque to me what happens with the reactor, when and how it trigge= rs. The dependency graph must have been well-formed, or it couldn't compile= . So why can I not get Maven to reproduce the same dependency graph for run= ning tests?_ > Further to that: > * I tried installing artifacts in cache using `mvn install:install`, tha= t didn't work > * I tried `mvn install` but was unable to get it to _not_ re-compile and= re-jar my artifacts > * I have tried simply copying files as a way to install my artifacts on = machines > Current status is, copying files manually to ~/.m2/repository is most pro= mising, it seems to work on Linux. However, it does not work on Windows, I'= m still trying to figure out why - line endings perhaps, the artifacts come= from a Linux machine. The problem is artifact lookup. > Anyway, going back to first principles: what's the recommended way to ach= ieve _running tests with Maven on pre-compiled project_? I'm hoping someone= has solved this before... > Regards, > Lasse > =C2=A0 -- This message was sent by Atlassian JIRA (v7.6.3#76005)