ant: list folders on command line - command-line

I'm new to ant. I'm looking to a way to do this
I have a folder, with a variable number of subfolders. Suppose subfolders are s1,s2,s3...,sN (N is not known)
I need to create and execute this command line
java -jar myjar.jar s1\ s2\ s3\ ... sN\
I would like to use standard task, but I do not know how to list folders on the command line.
Any help would really be appreciated!
Alberto

I think the 'fileset' type is what you're looking for:
http://ant.apache.org/manual/Types/fileset.html
The 'jar' task can work with implicit filesets, or you can define custom filesets within the jar task.
http://ant.apache.org/manual/Tasks/jar.html
See the examples at the bottom of the jar page.

You cac create an ant custom task which get the parent dir, a dirset or a patternset and writes all the names into an ant property
See more about it here http://ant.apache.org/manual/develop.html

Related

Netbeans, phpdocumentor, and custom phpdoc.dist.xml by project

I am using Netbeans 8.0.2 and phpdocumentor 2.8.2 on a windows 7 platform.
I would like to use custom phpdoc.dist.xml config files by project so I can specify framework directories and etc. to exclude from the generated doc. I also want to keep my Netbeans PHPDOC plugin config as generic as possible, without specific output directories, ignore options, config path parameters, etc., so on, so that that the config will apply to all my projects.
The phpdoc.dist.xml file works great. The doc generated is exactly what I want.
The problem or feature, and it seems to be a phpdocumentor one as it also applies from plain command line, is that the phpdoc.bat command (without a specific config parm) has to be run from the same root directory as the phpdoc.dist.xml file, or it ignores it. No problem if I'm using command line as I can change into that directory first, but I would like to use Netbeans. I have searched on this extensively and cannot find an answer.
I considered whether to modify the phpdocumentor files to insert cd /D path/to/myproject/dir to change the directory using some Netbeans variable to represent myproject/dir, but I could not find the right place in the code or the variable to use. Plus, then I'm supporting a custom mod to phpdocumentor.
I did find these directions for a PHPStorm setup, where the author specified a PHPStorm variable for the --config command line option to point to his custom phpdoc.dist.xml.
--config="$ProjectFileDir$/phpdoc.dist.xml"
If I could do the same in Netbeans like maybe "${BASE_DIR}/phpdoc.dist.xml" it would be great, but so far I haven't hit on anything Netbeans will recognize/pay attention to in the PhpDoc script: box.
I have also tried writing a wrapper .bat file to capture my own command line variable %1 and do the directory change to that before calling phpdoc.bat, but Netbeans throws and error and says that's not a valid .bat file. I cannot find any phpdocumentor parameter to configure by specific Netbeans project but the output directory. And I would prefer not to be defining a bunch of projects on subdirectories in Netbeans, just to address phpdocumentor.
Now I am out of ideas. Can anyone point me to a solution?

"Not A Valid Jar" When trying to run Map Reduce Job

I am trying to run a my MapReduce job by building a jar from eclipse , but while trying to execute the job , I am getting "Not a valid Jar" error.
I have tried to follow the link Not a valid Jar but that didnt help.
Can anyone please give me the instructions on how to build the jar from eclipse, for it to run on Hadoop.
I am aware of the process of building the Jar file from eclipse,however I am not sure, do I have to take any special care for building a jar file, so that it runs on Hadoop.
When you submit the command, make certain you have the following things on the line to do the command:
When you indicate the jar, make certain you are directing to the jar properly. It may be easiest to be certain by using the absolute path. To get the absolute path, if you navigate to the place where the jar is, then run 'readlink -f ' command to get the absolute path. So for you, not just hist.jar, but maybe /home/akash_user/jars/hist.jar or wherever it is on your system. If you are using Eclipse, it may be saving it somewhere funny, so make sure that is not the problem. The jar cannot be run from HDFS storage. must run from local storage.
When you name your main class, in your example Histogram, you must use the fully qualified name of the class, with the package, the project, and the class. So, usually, if the program/project is named Histogram, and there is a HistogramDriver, HistogramMapper, HistogramReducer, and your main() is in HistogramDriver, you need to type Histogram.HistogramDriver to get the program running. (Unless you made your jar runnable, which requires extra stuff at the beginning, making .mdf and things.)
Make sure that the jar you are submitting (hist.jar) is in the current directory from where you are submitting the 'hadoop jar' command.
If the issue is still persisting, please tell the Java, Hadoop and Linux version you are using.
You should not keep the jar file in HDFS when executing the MapReduce job. Make sure Jar is available in the local path. Input path and output directory should be the path from HDFS.

Is it possible to run a batch file from package manager console?

I'm using code first migrations with my context class in a class library (ie not the startup project) and I want to make batch files for the common operations to save having to pass in the parameters each time I want to add-migration and update-database. I ran the "dir" command in the console and it appears to be in the solution root folder so I have tried creating a .bat,.cmd or .ps1 file in the Solution Items folder but the package manager powershell doesn't seem to be able to find it?
At this very moment I am happening to read this from Bruce Payette's "Powershell in Action" (Wonderful book) so share something with you, lucky guy:
"In this example (Poster: an example in the book), even though hello.ps1 is in the current directory, you had to put ./ in front of it to run it. This is because Powershell doesn't execute commands out of the current directory by default. This prevents accidental execution of the wrong command."
Looks like I needed to just put a ".\" on the beginning of the batch file name - not sure if Powershell requires this to execute?

Is there a way to determine the directory the file being executed resides in?

And if so, is there way that asdf can import a symbol that is calculated in runtime.
I'm trying to to specify the directory on which the project resides so the test runner can find the input files and also when I run from the repl.
Yes, system-relative-pathname and system-source-directory are your friends. At least if you execute from source.
It depends on what you mean by "execution".
If your code is executed when your file is loaded, take a look at Variable *LOAD-PATHNAME*, *LOAD-TRUENAME*.
If you need the current working directory, asdf has getcwd and chdir.

Nunit: Can you open multiple projects in unit using a bat file?

I currently used a batch file which runs a project of mine which is simlar to the following:
nunit-gui.exe nunit.tests.csproj
Can it be setup to use two or more project files? I've tried adding quote marks and seperating the project names with commas and semi-colons but no luck.
Will I just have to create a master solution with all tests in and send that through as the parameter instead?
It is better to use NUnit project files. In the "config" section you can specify any number of assemblies to load.
Are you trying to run these by running a batch file? If so I think that nunit-console.exe or nunit-console-86.exe
Then to run multiple items its normally
nunit-console assem1.dll assem2.dll assem3.dll
I haven't tried it with project files but should work the same
http://www.nunit.org/index.php?p=consoleCommandLine&r=2.5.2