Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 49B331862F for ; Wed, 29 Jul 2015 10:57:41 +0000 (UTC) Received: (qmail 25751 invoked by uid 500); 29 Jul 2015 10:57:28 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 25713 invoked by uid 500); 29 Jul 2015 10:57:28 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 25702 invoked by uid 99); 29 Jul 2015 10:57:28 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Jul 2015 10:57:28 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id D1C6DC08EB for ; Wed, 29 Jul 2015 10:57:27 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.981 X-Spam-Level: X-Spam-Status: No, score=0.981 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id N5a2SwFA3nTu for ; Wed, 29 Jul 2015 10:57:20 +0000 (UTC) Received: from mail-ob0-f173.google.com (mail-ob0-f173.google.com [209.85.214.173]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id 2FC5142E74 for ; Wed, 29 Jul 2015 10:57:20 +0000 (UTC) Received: by obbop1 with SMTP id op1so4252060obb.2 for ; Wed, 29 Jul 2015 03:56:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-type:content-transfer-encoding :mime-version:subject:message-id:date:references:in-reply-to:to; bh=/YMyt4P4mOjf/+JfaVboyVHU2klnscqGe9ekXKPYx1c=; b=Gr8O4Vj0mm23aiNKh9W6Kmq3DZyZ9V+zb8e4yN5Rp5g9iPrz+/y0xM1WQhLsbxSHz+ Iupc5KMRsMpjjgZ2c6PddbRvyavqrsgGEnb7esGTSGRwnMteckg8IVQNZyALcvWX42d2 b4W/zuvFQXrKQBmyf8C4njELWz8+UcgTGsmOdV4XYWPwaSCoUXDdmz2VY6UTI0BihYN/ ykaZfOZ0cOpA7+AES8mJQP12C7QYjZuKS6KqSi89v2qbxH/oFSy/xF7LBBr7FtkVAPSU 1M/dbTuNIUX+siy83AEQG4ubDRnKv2NLoG6xrHeE9K5qTmVIR9xFbKPV5Q9hLFbCXGP1 fAbQ== X-Gm-Message-State: ALoCoQnPZ8v6g8Kb/2dg/nQEJ9fHcA1pG99ZIuysQPZsfNKXoFLri9PRsEONL8jTOe8/6MOatCDb X-Received: by 10.60.47.165 with SMTP id e5mr38559615oen.52.1438167394665; Wed, 29 Jul 2015 03:56:34 -0700 (PDT) Received: from [10.0.1.14] (ip72-205-54-70.dc.dc.cox.net. [72.205.54.70]) by smtp.gmail.com with ESMTPSA id v83sm14192382oie.17.2015.07.29.03.56.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jul 2015 03:56:33 -0700 (PDT) From: Michael Gentry Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) Subject: Re: Version API Message-Id: <04ADED15-843E-433E-8A41-EC4861BD0078@masslight.net> Date: Wed, 29 Jul 2015 06:56:31 -0400 References: <6EFB733A-E660-495B-A778-9EEE59F1415C@earthlink.net> <701DD749-E181-4103-9C45-316FA2D5F720@objectstyle.org> <347D3453-E5A8-4942-87D0-ED2C5711254F@objectstyle.org> <5AD2720C-07FB-4F7E-B704-50E470BEB1FA@earthlink.net> <87BDCE28-C824-4F52-8A27-F9D97562A88B@objectstyle.org> <44EB0ED1-7918-4CE5-A4A3-39998BD869A9@objectstyle.org> In-Reply-To: To: "user@cayenne.apache.org" X-Mailer: iPhone Mail (12H143) Maybe we should add a Cayenne.getVersion() method? > On Jul 27, 2015, at 10:41 AM, Mike Kienenberger wrote= : >=20 > Our jar MANIFEST file also contains: >=20 > Bundle-Version: 4.0.0.M2 >=20 > But shouldn't we also be supplying this information as >=20 > Implementation-Version: 4.0.0.M2 >=20 > so it's in a standardized place? >=20 > I'd guess that's a simple maven build change -- I know how to do it > under ant, but not under maven. >=20 >=20 > Once we do that, then we can use the standard java libraries to > provide the information: >=20 > Object object =3D new CayenneRuntimeException(); > Package objPackage =3D object.getClass().getPackage(); > System.out.println("Implementation Version: " + > objPackage.getImplementationVersion()); >=20 > produces >=20 > Implementation Version: 4.0.0.M2 >=20 > when I add an Implementation-Version: line to the MANIFEST in > cayenne-server-4.0.M2.jar >=20 > =3D=3D=3D=3D=3D > Manifest-Version: 1.0 > + Implementation-Version: 4.0.0.M2 > Export-Package: org.apache.cayenne;uses:=3D"org.apache.cayenne.reflect,o= > =3D=3D=3D=3D=3D >=20 >> On Mon, Jul 27, 2015 at 9:57 AM, Andrus Adamchik = wrote: >>=20 >>> On Jul 27, 2015, at 4:21 PM, Joe Baldwin wrote= : >>>=20 >>> 1. My goal is to display the version of cayenne server jar I have added t= o the project with Cayenne 4.0. >>=20 >> As it happens, Project.CURRENT_PROJECT_VERSION (or its 4.0 alternative) i= s not the same as the version of cayenne server jar. It denotes the version o= f the XML mapping format, which does not align with the .jar version. >>=20 >> If you need the version of the jar, here is another approach. While you a= re not using Maven, Cayenne is assembled with Maven, so each Cayenne jar has= some extra metadata that you get for free. Namely there's a "pom.properties= " file that you can read and get the version: >>=20 >> Properties props =3D new Properties(); >> String path =3D "META-INF/maven/org.apache.cayenne/cayenne-server/pom.pro= perties"; >> try(InputStream in : ObjectContext.class.getClassLoader().getResourceAsSt= ream(path)) { >> props.load(in); >> } >>=20 >> String version =3D props.getProperty("version"); >>=20 >> Andrus >>=20 >>=20