I'm using Ant to run a custom regex based checkstlye for */.html files. It's very simple config.
Ant build.xml:
<taskdef resource="checkstyletask.properties" classpath="checkstyle-5.5-all.jar"/>
<target name="check">
<checkstyle config="checks.xml" failOnViolation="false">
<fileset dir="${basedir}" includes="**/*.html"/>
<formatter type="plain"/>
<formatter type="xml" toFile="${basedir}/reports/checkstyle-report.xml"/>
</checkstyle>
</target>
checks.xml:
<module name="Checker">
<property name="charset" value="UTF-8"/>
<module name="RegexpMultiline">
<property name="format" value="\A.+<table>.+<\/table>.+\Z"/>
</module>
</module>
On Windows 7 64bit:
Apache Ant(TM) version 1.8.3 compiled on February 26 2012,
BUILD SUCCESSFUL
Total time: 1 second
On CentOS 64bit:
Apache Ant(TM) version 1.8.2 compiled on May 13 2011,
BUILD FAILED
build.xml:8: Unable to create a Checker: cannot initialize module RegexpMultiline - Unable to instantiate RegexpMultiline
Can anyone suggest something?
Thanks,
Ok, so simply running ant -v revealed the following:
parsing buildfile jar:file:/usr/share/java/ant-1.8.2.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/usr/share/java/ant-1.8.2.jar!/org/apache/tools/ant/antlib.xml from a zip file
...
[checkstyle] checkstyle version 4.4
[checkstyle] compiled on Mon December 06 2010, 21:35 GMT
So the reason for the failure is not so much to do with the OS, as the version & configuration of the Ant installation.
I think what's happening is that the v4.4 checkstyle is being picked up from
/usr/share/java/ant-1.8.2.jar!/org/apache/tools/ant/antlib.xml
in preference to what is specified in build.xml:
<taskdef resource="checkstyletask.properties" classpath="${basedir}/checkstyle/checkstyle-5.5-all.jar"/>
Update:
I didn't find checkstyle.jar in /usr/share/ant/lib/, but there was one in /usr/share/java/
Not sure how Ant was picking that up, but this is what has finally fixed the issue:
yum remove checkstyle4.noarch
Now Ant is free to use the .jar from the project!
Others may find this stackoverflow question relevent
Related
I am trying to use sample Axis2Client but I am facing an issue as below. I am following the page https://docs.wso2.com/display/EI6xx/Using+the+ESB+as+JMS+Consumer+and+Producer.
ant stockquote -Dmode=placeorder -Dtrpurl="jms:/StockQuoteProxy?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.ContentTypeProperty=Content-Type&transport.jms.DestinationType=queue"
Buildfile: /Users/user/WUM/wso2ei-6.6.0/samples/axis2Client/build.xml
init:
BUILD FAILED
/Users/user/WUM/wso2ei-6.6.0/samples/axis2Client/build.xml:307: /Users/user/WUM/wso2ei-6.6.0/wso2/lib/endorsed does not exist.
Total time: 0 seconds
How to fix this issue?
Could you please remove the following from the build.xml located in wso2ei-6.6.0/samples/axis2Client. Then try executing the same command again
<fileset dir="../../wso2/lib/endorsed">
<include name="*.jar"/>
</fileset>
I tried to install solidity extension for Visual Studio 2017, I downloaded VSIX Installer from the link bellow:
https://marketplace.visualstudio.com/items?itemName=ConsenSys.Solidity
when I tried to run the VSIX file, the installation failed immediately with the given message:
"Install Failed
The install of the extension was not successful for all the selected products. For more information, click the install log link at the bottom of the dialog.
This extension is not installable on any currently installed products."
I also tried to read the log file but it is very huge and many different things happened there. I appreciate if someone who had the same experience and fixed it could advice me how to fix it.
For anyone who is trying to install on VS 2017 just open the extract the package and then edit the extension.vsixmanifest to change the wrongly added brackets to square brackets. As below:
<InstallationTarget Version="[14.0,15.0]" Id="Microsoft.VisualStudio.Pro" />
<InstallationTarget Version="[14.0,15.0]" Id="Microsoft.VisualStudio.Community" />
<InstallationTarget Version="[14.0,15.0]" Id="Microsoft.VisualStudio.Enterprise" />
If still you face issue, With out converting to .zip file, do " Open Archive " - With in that edit the files as below
<Installation>
.... Version="[14.0,15.0]"
.... Version="[14.0,15.0]"
.... Version="[14.0,15.0]"
</Installation>
<Dependencies>
.... Version="[4.5,]"
</Dependencies>
save the file and run as it. ( Here there is no conversion from vsix to zip and back - edit is direct on the vsix ) - Installation is success for me.
The page says "Works with Visual Studio 2015".
I have created an React+Redux using the .Net Core 2.0 template. I didn't change anything yet it's not buildind.
Severity Code Description Project File Line Suppression State
Warning MSB3073 The command "node --version" exited with code
1. WebApplication2 C:\Tests\WebApplication2\WebApplication2\WebApplication2.csproj 25
Yet, node is properly installed, when I run "node --version" in a prompt (from any drive/directory) I get v8.4.0 and no error code (the expected behaviour).
I tried using the full path in the .csproj file.
<Exec Command=""C:\Program Files\nodejs\node" --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
And I'm still getting the same error
Severity Code Description Project File Line Suppression State
Warning MSB3073 The command ""C:\Program Files\nodejs\node" --version"
exited with code
1. WebApplication2 C:\Tests\WebApplication2\WebApplication2\WebApplication2.csproj 25
I reinstalled NodeJS, with the same results.
Then I even tried a dummy task calling dos echo 0 and it still fails.
Severity Code Description Project File Line Suppression State
Warning MSB3073 The command "echo 0" exited with code
1. WebApplication2 C:\Tests\WebApplication2\WebApplication2\WebApplication2.csproj 25
What's going on?
Here's the whole segment which does the check:
<Target Name="DebugRunWebpack" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('wwwroot\dist') ">
<!-- Ensure Node.js is installed -->
<Exec Command=""C:\Program Files\nodejs\node" --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
<!-- In development, the dist files won't exist on the first run or when cloning to
a different machine, so rebuild them if not already present. -->
<Message Importance="high" Text="Performing first-run Webpack build..." />
<Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js" />
<Exec Command="node node_modules/webpack/bin/webpack.js" />
</Target>
This had been related to security issue of some sort.
Running "dotnet run" from a command prompt run with admin rights "fixed" the issue.
I ran into this issue (I realized that my node_modules folder wasn't there) so I upgraded my .Net Core app to 2.1 and ran npm i and that worked.
Doesn't hurt to just try npm i and try again
I am trying to migrate from Java 7 to Java 8 for an existing system , which implements Jax-ws 2.0. The build and deployment process is uses Ant task (apt, wsgen, wsimport) to generates wsdl and libraries from java annotated service end point interface and from generated WSDL prepares client libraries. Which works as expected until Java – 7. But when I tried to use jdk-8 for building, got problem in using jax-ws libraries and above mentioned ant task. I have upgraded the JAX-WS lib to JAX-WS RI – 2.2.8 and JAX-WS 2.2.10 , which did work until WSDL and schema generation using ant task wsgen, but Still I am unable to resolve the generation of client libraries from generated WSDL using wsimport. I am getting following error
javax.xml.validation.SchemaFactoryConfigurationError: Provider for class javax.xml.validation.SchemaFactory cannot be created
My wsgen and wsimport scripts are as below :
<taskdef name="wsgen" classname="com.sun.tools.ws.ant.WsGen">
<classpath refid="project.classpath"/>
</taskdef>
<wsgen resourcedestdir="${smruti.wsdl.dir}"
sei="com.smruti.webservice.SmrutiWebService"
keep="true"
sourcedestdir="${smruti.wsdl.dir}\src"
destdir="${build.dir}"
genwsdl="true">
<classpath>
<path refid="project.classpath"/>
<pathelement location="${build.dir}"/>
</classpath>
</wsgen>
<taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
<classpath refid="project.classpath" />
</taskdef>
<wsimport sourcedestdir="${generated.dir}/src" destdir="${build.dir}" wsdl="${wsdl.location}" keep="true" extension="true" package="com.smruti.webservice.client"/>
Note : I am using jdk 8 , ant- 1.9.4 , jax-ws ri - 2.2.10 libs.
As a work around I am able to solve the above problem by using jdk provided wsimport.exe instead of ant task. Below is the script for the same ..
<exec executable="C:\Program Files\Java\jdk1.8.0_40\bin\wsimport.exe">
<arg line="${wsdl.location} -s ${generated.dir}/src -p com.smruti.webservice.client -d ${build.dir} -extension -keep -Xdebug -verbose" />
</exec>
But, Still not able to use wsimport as an ant task with java 8 and jax-ws-2.2.10.
I have a python script that is doing some deployment.
I want to run that script from msbuild and get the output in case it pass, or failed.
So, how can I communicate to msbuild of the status , and the error text?
I want to show the result on the build server.
I have to use python 2.7, and cannot use 3.x
Run the command using the Exec task and capture it's output. For example:
<Target Name="GetPythonOutput">
<PropertyGroup>
<PyCommand>/path/to/python.exe -a /path/to/pthonfile</PyCommand>
<TempFile>ExecTempFile</TempFile>
</PropertyGroup>
<Exec Command="$(PyCommand) > $(TempFile)" />
<ReadLinesFromFile File="$(TempFile)">
<Output TaskParameter="Lines" ItemName="PyOutput"/>
</ReadLinesFromFile>
<Delete Files="$(TempFile)" />
<Message Text="Python command output was: #(PyOutput)" />
</Target>
If you are using .Net 4.5 things are better since Exec can do most of the work for you