error invalid source option, source is either '1.3' or '1.4': Browserstack integration with Azure Devops Pipeline - browserstack

I am trying to integrate browserstack with azure devops pipelines. I added all the necessary repos to the pom.xml While building the code i am getting below error. And i am following this link https://www.browserstack.com/docs/automate/selenium/azure-pipelines#java
I keep on getting the source failure and says 1.3 or 1.4 i am using Jdk 1.8 version. I defined jdk source as 1.8 and jdk target as 1.8
<plugin>
<groupId>com.browserstack</groupId>
<artifactId>automate-maven-plugin</artifactId>
<version>1.1.1</version>
<configuration>
<source>${jdk.source.version}</source>
<target>${jdk.target.version}</target>
<complianceLevel>${jdk.source.version}</complianceLevel>
</configuration>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
Caused by: org.codehaus.mojo.aspectj.CompilationFailedException: AJC compiler errors:
error invalid source option, source is either '1.3' or '1.4': 1.8
abort AspectJ Compiler
Usage: <options> <source file | #argfile>..
AspectJ-specific options:
-inpath <list> use classes in dirs and jars/zips in <list> as source
(<list> uses platform-specific path delimiter)
-injars <jarList> use classes in <jarList> zip files as source
(<jarList> uses classpath delimiter)
deprecated - use inpath instead.
-aspectpath <list> weave aspects in .class files from <list> dirs and jars/zip into sources
(<list> uses classpath delimiter)
-outjar <file> put output classes in zip file <file>
-outxml generate META-INF/aop.xml
-outxmlfile <file> specify alternate destination output of -outxml
-argfile <file> specify line-delimited list of source files
-showWeaveInfo display information about weaving
-incremental continuously-running compiler, needs -sourceroots
at org.codehaus.mojo.aspectj.CompilationFailedException.create(CompilationFailedException.java:35)
at org.codehaus.mojo.aspectj.AbstractAjcCompiler.execute(AbstractAjcCompiler.java:549)
at com.browserstack.automate.mojo.AutomateBaseMojo.execute(AutomateBaseMojo.java:114)
at com.browserstack.automate.mojo.AutomateCompileMojo.execute(AutomateCompileMojo.java:18)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
... 20 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Related

Liquibase and JAR dependencies

I'm new to Liquibase but I've got it set up and it's working OK for me, but I've manually downloaded all dependent JAR files to get it working.
Now I want to set up a pom.xml and let Maven worry about downloading dependences. For some reason I can't get that to work at all. Maven runs and finds what it thinks are all the dependencies, but then Liquibase immediately crashes every time it starts. With version 3.5.5 up through 3.8.0 it crashes with NoClassDefFoundError on org/slf4j/LoggerFactory; on 3.8.1 and above it fails with the same error on ch/qos/logback/core/Context. I've triple-checked my classpath settings and I'm sure they are correct.
So my question is this: Fundamentally, should it be possible to set up a dependency on liquibase-core in a pom.xml file, let Maven download all dependencies, and use those and only those dependencies in the java call (other than the JDBC driver, of course)?
Everything I know about Maven tells me that this should work, but I've been trying for hours and for the life of me cannot get Liquibase to work with the dependent JARs which Maven downloads. And strangely, it does seem to download the JARs I would have expected are missing: slf4j-api (1.7.25) and logback-core (1.2.3). but for whatever reason it seems to be calling methods which aren't defined in them (version skew somehow?).
Here is my "pom.xml" file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.myproject</groupId>
<artifactId>myapp-lib</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.8.7</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>default-cli</id>
<configuration>
<artifactItems>
<artifactItem>
<groupId>
GetLiquibaseJars
</groupId>
<artifactId>GetLiquibaseJars</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>[ packaging ]</type>
<outputDirectory>${MYAPP_ROOT}/lib</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
When run, that downloads:
jaxb-api-2.3.0.jar
logback-classic-1.2.3.jar
liquibase-core-3.8.7.jar
slf4j-api-1.7.28.jar
logback-core-1.2.3.jar
so logback-core is available. Here's my Java call:
java -classpath "/home/myself/proj/my_app/lib/jaxb-api-2.3.0.jar:\
/home/myself/proj/my_app/lib/liquibase-core-3.8.7.jar:\
/home/myself/proj/my_app/lib/logback-core-1.2.3.jar:\
/home/myself/proj/my_app/lib/logback-classic-1.2.3.jar:\
/home/myself/proj/my_app/lib/slf4j-api-1.7.28.jar" \
-jar /home/myself/proj/my_app/lib/liquibase-core-3.8.7.jar \
--classpath=/home/myself/proj/my_app/links/sybase-linux/jConnect-6_0/classes/jconn3.jar \
--url=jdbc:sybase:Tds:mydbserver.mycompany.com:1234 \
--defaultSchemaName=dbo --username=my_user \
--password=my_pwd \
--changeLogFile=/home/myself/proj/my_app/db/changelog.xml \
--logLevel=info status
The exception I get is:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: ch/qos/logback/core/Context
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at
sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at
sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.core.Context
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
I've confirmed the jar file are readable, and as far as I can tell this "Context" class is defined in logback-core v1.2.3.
Update: Interestingly, if I replace the "-jar /home/myself/proj/my_app/lib/liquibase-core-3.8.7.jar" with a call to the Main, i.e. "liquibase.integration.commandline.Main", it works fine. But calling the main Liquibase core JAR file as a runnable jar with "-jar" seems to cause Java to completely ignore the entire classpath, and crash on the first external dependency it sees.

How To Build Child Modules In Tycho

I have a multi-module Tycho build with a target definition file. The target definition is defined in it's own project (ID: org.acme.project.target, packaging type: pom) like this:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>platform_rcp.target</file>
<type>target</type>
<classifier>platform_rcp</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
And the Maven parent refers to this target platform like this:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<configuration>
<resolver>p2</resolver>
<target>
<artifact>
<groupId>${project.groupId}</groupId>
<artifactId>org.acme.project.target</artifactId>
<version>${project.version}</version>
<classifier>platform_rcp</classifier>
</artifact>
</target>
</configuration>
</plugin>
This setup works as long as I build the parent project. When I build one of the child modules, even if this project duplicates the reference to the target platform OR even when I build the parent with mvn install -pl org.acme.project I get the following exception:
[ERROR] Internal error: java.lang.RuntimeException: Could not resolve target platform specification artifact myGroup:org.acme.project.target:target:platform_rcp:2.3.0-SNAPSHOT -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: Could not resolve target platform specification artifact myGroup:org.acme.project.target:target:platform_rcp:2.3.0-SNAPSHOT
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:121)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
Even the Tycho example doesn't work for me, but brings the same error message (Could not resolve target platform specification artifact example.group:mars:target:1.0.0-SNAPSHOT).
I thought this question was similar, but my setup is exactly what is said to work in the answer.
What did I do wrong?
(The actual problem in question is that Eclipse Mars can't run integration tests, so I can only use Tycho to run them, which needs a long time when Tycho builds all modules.)
even when I build the parent with mvn install -pl org.acme.project I get the following exception:
Have you tried prepending the target platform project to the list of -pl arguments: mvn install -pl :mars,org.acme.project
I use this all the time.

Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor

[INFO] [war:war {execution: default-war}]
[INFO] Packaging webapp
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
---- Debugging information ----
message : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
cause-exception : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
class : org.apache.maven.plugin.war.util.WebappStructure
required-type : org.apache.maven.plugin.war.util.WebappStructure
path : /webapp-structure
line number : 1
-------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Trace
com.thoughtworks.xstream.converters.ConversionException: Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
---- Debugging information ----
message : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
cause-exception : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
class : org.apache.maven.plugin.war.util.WebappStructure
required-type : org.apache.maven.plugin.war.util.WebappStructure
path : /webapp-structure
line number : 1
-------------------------------
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:63)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46)
at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:117)
at com.thoughtworks.xstream.core.ReferenceByXPathMarshallingStrategy.unmarshal(ReferenceByXPathMarshallingStrategy.java:29)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:846)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:833)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:781)
at org.apache.maven.plugin.war.util.WebappStructureSerializer.fromXml(WebappStructureSerializer.java:73)
at org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:404)
at org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:375)
at org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:181)
at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:143)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: com.thoughtworks.xstream.converters.reflection.ObjectAccessException: Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.newInstance(PureJavaReflectionProvider.java:59)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.instantiateNewInstance(AbstractReflectionConverter.java:257)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:124)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56)
... 31 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Sat Sep 24 17:25:45 CEST 2011
[INFO] Final Memory: 15M/37M
[INFO] ------------------------------------------------------------------------
JDK: 1.7
Maven compiler Plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</plugin>
When I run install target above error occurs, how can I resolve it?
Perhaps a version of maven war plugin is being used, which does not work with Java 7? As per this issue (which describes a similar problem), 2.1.1 version of maven war plugin should work.
Include the following in your pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
</plugin>
I had this problem when doing a mvn install. I resolved it by doing a mvn clean first, followed by a mvn install.
Using maven 2.1.1, JDK 1.7.0.45.
It's confirmed: JDK7 with Maven 2.x will produce this error.
I am using Maven 2.2.1 and JDK7 and got this error. I changed the JDK to version 1.6 and it's working fine.
Instead of changing JDK versions and Maven versions, try this:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
<version>2.3.2</version>
</plugin>
Confirmed, I ran into the same issue with maven 3.0.2 and jdk 1.7.0_02. After running against jdk 1.6.0_30 it compiled just fine.
I don't think the version was the problem.
I solved deleting my target folder (because it contains webapp-cache.xml) and doing Maven install again.
Apache Maven WAR Plugin 3.0.0 resolved all issues:
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
It doesn't matter if you use jdk 1.6, 1.7 or 1.8
This definitely seems to be related to incompatible plugin, library and language versions.
Two years, and two Java versions later, I had this same error while doing a sample project from an older book on Spring and Hibernate.
I was able to resolve the error by commenting out all of the version tags for the apache.maven.plugins and setting the Java version to 1.8. This let me know what was the latest and greatest version of the libraries, with the cost of some warnings from Maven about missing the version tags. If you care about the warnings, you can set the version tags to be latest version and the warnings from Maven should go away.
I executed mvn clean package and then just mvn package.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<!-- <version>2.1-beta-1</version> -->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<!-- <version>2.1</version> -->
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
if your using jdk 1.6 kindly add this plugin entry to your pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
I had this problem with my eclipse Kepler. As soon as I moved to 4.4 (Luna) , all gone. Must be an issue with eclipse + maven embedded
I tried both JDK 1.7 and 1.8. No difference.
For me changing plugin version could not solve problme and changing JDK version is not in my control.
However running mvn clean before mvn tomcat6:deploy solved this problem.
Make sure to have the JDK version in your Build path and the version specified in the
source tag match the same.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<configuration>
**<source>1.7</source>**
<target>1.7</target>
<debug>true</debug>
</configuration>
</plugin> `
I had the build path pointing to jdk 1.7 and "1.6" in the source tag, when I corrected the version to 1.7 in source tag the issue got resolved.
Execute mnv clean and mvn package.
Try to delete all your cache. When i deleted target folder, it works fine.
(Target folder is where maven puts all compiled code)
I was getting the same error after i upgraded my java version from 8 to some 8.x, i fixed it by going to pom then 1. right click > maven > add plugin 2. type in org.apache.maven and then look for war plugin add it and save, then just clean and install. It should work.
use this plugin
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
</plugin>
Example pom.xml
pom.xml screenshot`
Use this below plugin to get rid of this issue ( Latest ) and refer this
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
<finalName>SampleProject</finalName>
</build>

maven-antrun-plugin 1.6 want to compile classes with Java 1.4.2 version

I'm using an ant build.xml that generates classes and compiles them with the tools.jar from the JDK.
I am using MAVEN 2.2.1 version. JDK 1.5 to execute MAVEN. As maven 2.2.1 version supports higher then JDK 1.5 only so I have to use it.
This maven-antrun-plugin doesn't allow to specify neither source or target version for the compiler.
So, the generated classes are compiled against the currently running JVM which is JDK , using its rt.jar and the tools.jar provided in plugin dependencies (or placed in the lib/ext directory of the jvm).
As Maven is executed in a 1.5 JVM (jdk1.5.0_22) is needed for my project to compile these classes with JDK 1.4.2 version because the server where I want to deploy them is running on a 1.4 JVM, so I am getting exception while I am compiling with MAVEN plugin from my eclipse or command line.
I couldn't find a way to tell antrun to compile my classes using a different java version.
I tried the following workarounds :
change the tools.jar dependency to point to a 1.4 version => as the compiler uses the rt.jar from the currently running 1.5 JVM, the class file version doesn't match (version 49.0, expecting 48.0)
add a dependency to a 1.4 rt.jar => it doesn't change anything, as the rt.jar should be specified in the boot classpath.
Following one is the sample code which i am using.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
<compilerVersion>${java-version}</compilerVersion>
<compilerArguments>
<classpath>${java.home}/lib/tools.jar</classpath>
<classpath>${java.home}/jre/lib/rt.jar</classpath>
</compilerArguments>
<tasks>
<ant antfile="WPSEjb_build.xml"/>
</tasks>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>crimson</groupId>
<artifactId>crimson</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>sun.jdk</groupId>
<artifactId>tools</artifactId>
<version>1.4.2</version>
<scope>system</scope>
<systemPath>${java.home}/lib/tools.jar</systemPath>
</dependency>
<dependency>
<groupId>com.sun</groupId>
<artifactId>rt</artifactId>
<version>${java-version}</version>
<scope>system</scope>
<systemPath>${java.home}/jre/lib/rt.jar</systemPath>
</dependency>
</dependencies>
</plugin>
I am getting exceptions something like this.
WPSClient.java:22: cannot access java.lang.Object
[wlwBuild] [Build] bad class file: C:\Java\jdk1.5.0_22\jre\lib\rt.jar(java/lang/Object.class)
[wlwBuild] [Build] class file has wrong version 49.0, should be 48.0
[wlwBuild] [Build] Please remove or make sure it appears in the correct subdirectory of the classpath.
[wlwBuild] [Build] public static WPSServerRemote getWPSServer() throws MitchellException {
[wlwBuild] [Build] ^
[wlwBuild] [Build] 3 errors
[wlwBuild] [Build] BUILD FAILED
[wlwBuild] [Build] Compile failed; see the compiler error output for details.
[wlwBuild] [Build]
[wlwBuild] java.lang.reflect.InvocationTargetException
[wlwBuild] java.lang.reflect.InvocationTargetException
[wlwBuild] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[wlwBuild] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[wlwBuild] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[wlwBuild] at java.lang.reflect.Method.invoke(Method.java:592)
[wlwBuild] at workshop.core.Compile.start(Compile.java:19)
[wlwBuild] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[wlwBuild] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[wlwBuild] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[wlwBuild] at java.lang.reflect.Method.invoke(Method.java:592)
[wlwBuild] at workshop.core.Starter.invokeStart(Starter.java:34)
[wlwBuild] at workshop.core.Compile.main(Compile.java:9)
[wlwBuild] Caused by: java.lang.NoClassDefFoundError: org/apache/crimson/tree/XmlDocument
[wlwBuild] at workshop.util.ide.PreferencesNode._export(PreferencesNode.java:540)
[wlwBuild] at workshop.util.ide.PreferencesNode.exportSubtree(PreferencesNode.java:820)
[wlwBuild] at workshop.util.ide.PreferencesNode.flush(PreferencesNode.java:984)
[wlwBuild] at workshop.core.App$15.run(App.java:1000)
[wlwBuild] at workshop.core.asynctask.AsyncTaskManager.showDialogWhileRunning(AsyncTaskManager.java:272)
[wlwBuild] at workshop.core.asynctask.AsyncTaskManager.showDialogWhileRunning(AsyncTaskManager.java:482)
[wlwBuild] at workshop.core.App.exit(App.java:994)
[wlwBuild] at workshop.core.CompileHelper.compile(CompileHelper.java:298)
Please let me know how can I setup JDK 1.4.2 Version to Compile my classes by using maven-antrun-plugin.
Newer versions of the JDK can compile code to be run on older JDKs. Just set your target to 1.4 if that's the version of the JDK on your server.
You might want to check out the java compiler usage guide for 1.5 and check out the target option to get a better understanding of how the compiler handles this.
EDIT: To clarify, the part of your pom that calls out the target version is ${java-version}. That will be passed to javac as the target option. You'll want to tell it 1.4, since minor version numbers are not used.
I am able to build it by using following command.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>C:\test\Ejb.bat</executable>
</configuration>
</plugin>
I am calling ant -f build.xml build command under Ejb.bat file. Which is using all configuration which i am giving under build.xml so i am able to build with JDK 1.4.2 version now.

Unable to disable generation of sources JAR with maven-release-plugin

I am trying to release a web project using Maven 2.2.1 and the maven-release-plugin 2.0-beta-9, but it always fails when doing release:perform on generating the sources jar for the EAR project, which makes sense since the EAR project doesn't have any source.
[INFO] [INFO] [source:jar {execution: attach-sources}]
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] BUILD ERROR
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Error creating source archive: You must set at least one file.
To try to disable the building of a sources JAR for the EAR project, I added the following to the POM for my EAR project (the version of the release plugin is set in a parent POM):
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<useReleaseProfile>false</useReleaseProfile>
</configuration>
</plugin>
</plugins>
</build>
Upon running the release again after checking in this change, I got the same error while generating the sources JAR for the EAR project, even though this should have been disabled by the previous POM snippet.
What am I doing wrong? Why is the sources JAR still being built?
Edit:
I've tried to make the source plugin include my application.xml file so that this error doesn't occur by adding the following POM snippet:
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<includes>
<include>${basedir}/META-INF/**/*</include>
</includes>
<useDefaultExcludes>false</useDefaultExcludes>
</configuration>
</plugin>
</plugins>
</build>
Unfortunately, this does not fix the problem either.
I finally figured it out. I needed to add my source files as part of the references:
<resources>
<resource>
<directory>${project.basedir}</directory>
<includes>
<include>META-INF/**/*</include>
</includes>
<excludes>
<exclude>target/**/*</exclude>
<exclude>bin/**/*</exclude>
<exclude>META-INF/.svn/**/*</exclude>
</excludes>
</resource>
</resources>
Doing this made everything work again. I didn't need any special configuration for the release or source plugins to get it to work.
There was a bug in the maven-source-plugin version 2.1 that resulted in the same error as you describe here. Newer Version >= 2.1.1 contain the fix. Here is a link to this Bug for further information. http://jira.codehaus.org/browse/MSOURCES-44