I am creating a WAR file using Ant. When WAR is created it has MANIFEST.MF file with the default content :
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.4
Created-By: 1.7.0_07-b10 (Oracle Corporation).
So, when the WAR is created it should also have Build Revision Number/Head revision number of SVN and the MANIFEST.MF in the WAR should look like this:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.4
Created-By: 1.7.0_07-b10 (Oracle Corporation)
Revision: #Head Revision number
I would recommend to use buildnumber-maven-plugin. See this article for more details: http://manifests.jcabi.com/versioning.html
Also, see this post for more details: http://www.yegor256.com/2014/07/03/how-to-read-manifest-mf.html
Related
We trigger jetty through ant target as below
<target name="jettysh" depends="init">
<exec executable="${JETTY_HOME}/bin/jetty.sh" failonerror="true">
<env key="JAVA_OPTIONS"
value="-server -d64 ${x} ${y} ${z} ${l} -Dsettings.path=${p.path} -Dlog4j.configuration=file:///${dpath}/conf/sample.xml -Djetty.secure.port=${JETTY_SECURE_PORT} -Dapp.dir=${app.dir}"/>
</exec>
</target>
In this we pass -Dlog4j.configuration path in the older log4j 1.X version as we are migrating to newer version we are passing the new configuration -Dlog4j2.configurationFile but the logs are not getting generated .
And also we are not seeing any log files getting generated that means that log configuration itself is not picked
Help is very much appreciated as it is a time bound one.
Jetty Hightide 7.x does not have support for log4j2 at the server level.
Using that ancient EOL version of Jetty, you only have support for log4j2 within your webapps.
That means you have to put the log4j2 jars and it's configuration files in your WAR file.
The project has the following structure:
M
+---A
+---B
| +---B1
| +---B2
|
+---C
+---D
Every folder (M,A,B,B1,B2,C,D) contains a pom.xml file.
The pom.xml file from B1 contains the following lines:
<configuration>
<filters>
<filter>B/B1/PATH_TO_FILE_X</filter>
</filters>
</configuration>
Running
mvn clean install -Px -Dy -X
from the M folder:
using assembly plugin 2.4, everything works fine. It looks for path\M\B\B1\PATH_FO_FILE_X and it exists. (absolute path = project path + specified path)
using assembly plugin 2.4.1 (or 2.5.3), the file is not found. It looks for path\M\B\B1\B\B1\PATH_TO_FILE_X and there is a java.io.FileNotFoundException. (absolute path = submodule path + specified path)
I can manually change every path that cannot be resolved, but it's too risky because some paths can be resolved in a wrong way. If there is B\B1\PATH_TO_ANOTHER_FILE_X in B\B1\ it could cause problems.
Is there a generic method to solve this problem (keeping backward compatibility from 2.4 to 2.4.1)?
Details:
Maven 3.2.1
Java 7
Windows 7
Update:
It seems to be related to maven-filtering 1.2 that was introduced in 2.4.1:
http://maven.40175.n5.nabble.com/Apache-Maven-Assembly-Plugin-Version-2-4-1-Released-td5801647.html
https://jira.codehaus.org/browse/MASSEMBLY-686
https://jira.codehaus.org/browse/MSHARED-161
http://jira.codehaus.org/browse/MWAR-301
http://mail-archives.apache.org/mod_mbox/maven-announce/201211.mbox/%3C1791127681.01353276825400.JavaMail.Dennis#Dennis-Dator%3E
The following line from 2.4:
<mavenFilteringVersion>1.1</mavenFilteringVersion>
was replaced by
<mavenFilteringVersion>1.2</mavenFilteringVersion>
in 2.4.1.
I am using wlappc command in ant script to build jar and I have weblogic.jar in classpath.
ejb3Compile:
[echo] "Compiling EJB"
[wlappc] Created working directory: /var/tmp/appcgen_1423590774747_VMS.jar
[wlappc] java.lang.RuntimeException: error in finding weblogic.Home
[wlappc] at weblogic.Home.getInstance(Home.java:91)
[wlappc] at weblogic.Home.getPath(Home.java:97)
[wlappc] at weblogic.ejb.container.persistence.InstalledPersistence.setInstallationLocation(InstalledPersistence.java:299)
[wlappc] at weblogic.ejb.container.persistence.InstalledPersistence.initialize(InstalledPersistence.java:134)
You have a couple of options:
Use ant supplied within the weblogic install, this should know the home by default:
<install dir>/modules/org.apache.ant_1.7.1/bin/ant
Add the weblogic home as a parameter to ant:
ANT_OPTS=-Dweblogic.home="<install_dir>/wlserver_10.3"
Replace <install_dir> with the path to your Oracle install directory.
I am running into the following error when trying to run ant:
Problem: failed to create task or type runtarget
I am building on a mac 10.8.3.
Prior research has suggested that I add ant-contrib-0.3.jar to my ANT_HOME installation directory, which I have done (that had actually gotten rid of another 'failed to create task or type' error)
I used ant-contrib-0.3.jar because research suggested that this jar is mapped to the line:
< taskdef resource="net/sf/antcontrib/antcontrib.properties" />
which is in the build.xml file I am using.
The project builds on windows machines ( I even got it to build using https://code.google.com/p/winant/ ) but am trying to get it built on a mac. I am thus not looking to change the build.xml file.
An example of the run target line is:
<target name="setPASProps" depends="" description="setup the properties">
<property name="systemname" value="PAS"/>
<runtarget target="setSystemProps"/>
</target>
Here is some info from running ant -diagnostics
-------------------------------------------
ANT PROPERTIES
-------------------------------------------
ant.version: Apache Ant(TM) version 1.8.2 compiled on June 20 2012
ant.java.version: 1.7
Is this the Apache Harmony VM? no
Is this the Kaffe VM? no
Is this gij/gcj? no
ant.core.lib: /usr/share/ant/lib/ant.jar
ant.home: /usr/share/ant
-------------------------------------------
ANT_HOME/lib jar listing
-------------------------------------------
ant.home: /usr/share/ant
ant-antlr.jar (5756 bytes)
ant-contrib-0.3.jar (17708 bytes)
ant-jmf.jar (6745 bytes)
ant-junit.jar (102350 bytes)
ant-junit4.jar (7126 bytes)
ant-launcher.jar (12321 bytes)
ant-swing.jar (7563 bytes)
ant-testutil.jar (15198 bytes)
ant.jar (1937098 bytes)
Thanks !
It would be helpful if you posted your build.xml too.
You usually get this error if Ant sees a task, but there's a problem with the definition.
Here's my recommendation:
In your project create a directory antlib/ant-contrib.
Download this zip file. Ant-contrib is a wee bit strange is that there is a separate jar for C compiling and for all of the other Ant tasks. The latest version is 1.0b3. When you unzip this zip file, you will see ant-contrib-1.0b3.jar inside this folder.
Put that ant-contrib-1.0b3.jar inside the antlib/ant-contrib folder.
Now, in your build.xml, use the following <taskdef/>:
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<fileset dir="${basedir}/antlib/ant-contrib"/>
</classpath>
</taskdef>
Make sure this is not inside a target. You want this to be executed before any targets are executed.
I like doing the definition this way because the Ant Contrib jar file becomes part of my project, and anyone who needs to run my project will not have to manually install the Ant Contrib jar before they can use my project.
Take a look at your build.xml and see where that <Runtarget> task is being used. I've never used it, and the documentation for this task is so clear and helpful. Actually, I'm not even sure if it works. If you are still having problems, you try to see if you can remove the defined <target/> that contains this task, and see if that gets rid of the issue.
Removed ant-contrib-0.3.jar and added ant-contrib-1.0b3.jar and ant-contrib.jar to my ANT_HOME directory since these are the jars installed with https://code.google.com/p/winant/ (and it was working on windows machines).
This did the trick.
I'm running Ant 1.8.1 under Win 7. And my Java version is 1.7_17.
I add the following 2 lines in my build file for diagnosing.
<echo message="java.version = ${ant.java.version}" />
<echo message="java.home = ${java.home}" />
And the result is
[echo] java.version = 1.6
[echo] java.home = C:\Program Files\Java\jre7
Any idea on what's going on?
Is it hardcoded in Ant 1.8.1 that the highest java version it can show is 1.6?
I found this from Ant website. It's hardcoded actually.
ant.java.version the JVM version Ant detected; currently it can hold
the values "1.2", "1.3",
"1.4", "1.5" and "1.6".
After I update my Ant to 1.9.0, the issue is solved.
[echo] java.version = 1.7
[echo] java.home = C:\Program Files\Java\jdk1.7.0_17\jre
It's kind of funny. :)
It looks like you have JAVA_HOME set correctly, but do you have %JAVA_HOME%\bin included in your PATH environment variable ? It looks like you're currently picking up the java.exe from a Java 6 installation.
I think ant.java.version shows the Java version your Ant was built with. The actual version of your java installation is stored in java.version.