Category Archives: Quick Tip

Maven – Exclude Resources From Jar

A project I was working on recently had some… interesting packages in the source code.  There was a test package, a config package, and a notes package.  By placing these non-source items in the source folder, they were being included in the final jar that maven would build.

The ideal solution here is to move these packages to more appropriate places, such as a test source folder, a relative config folder in the application’s root, and maybe a private wiki for the team, respectively.

However, not even having enough time to do the work I was assigned, I decided I would at least prevent these items from cluttering up the jar, and I would return to move them properly at a later time.

You’ll want to use the maven-jar-plugin, and configure excludes as absolute package paths:

<plugins>
   <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-jar-plugin</artifactId>
      <version>2.3.1</version>
      <configuration>
         <excludes>
            <exclude>test/</exclude>
            <exclude>config/</exclude>
            <exclude>example/package/path/notes</exclude>
         </excludes>
      </configuration>
   </plugin>
</plugins>

Running JBoss EAP 6 as a Windows Service

I spent some time myself trying to figure out how to easily install JBoss EAP as a Windows service.  I then came across an excellent thread post on developer.jboss.org which let me do what I wanted.  My own post will be based on that.

Files You’ll Need

First, you’ll need commons-daemon-1.0.15.jar, which is from Apache and can be downloaded here.

Second, you’ll want prunsrv.exe, also from the Apache commons-daemon library.  But this item you’ll need to get from the Windows binary downloads section.

Lastly, you’ll need the batch file that will create the service for you, using the previously acquired jar and exe.  This file can be found directly in either the comment I am basing this post on (service.bat.zip), or the bugzilla ticket that post is basing itself on.

Place everything in %JBOSS_HOME%\modules\system\layers\base\native\sbin

Installing the Service

Open up a command prompt in the sbin directory previously mentioned.  And run

service.bat install

The parameters you can pass to this batch file are as follows (pulled from the batch file’s usage output):

  • /controller <host:port>: The host:port of the management interface
    • default: %CONTROLLER% – “localhost:9999”
  • /host [<domainhost>]: Indicates that domain mode is to be used with an optional domain controller name
    • default: %DC_HOST% – “master”
    • Not specifying /host will install JBoss in standalone mode
  • /loglevel <level>: The log level for the service: Error, Info, Warn or Debug (Case insensitive)
    • default: %LOGLEVEL% – “INFO”
  • /name <servicename>: The name of the service – should not contain spaces
    • default: %SHORTNAME% – “JBossEAP6”
  • /desc <description>: The description of the service, use double quotes to allow spaces
    • default: %DESCRIPTION% – “JBoss Enterprise Application Platform 6”
  • /serviceuser <username>: Specifies the name of the account under which the service should run.
    • Use an account name in the form DomainName\UserName
    • default: not used, the service runs as Local System Account
  • /servicepass <password>: password for /serviceuser
  • /jbossuser <username>: jboss username to use for the shutdown command
  • /jbosspass <password>: password for /jbossuser

Spybot Anti-Beacon – Turn Off Windows Tracking

Tracking / telemetry features in software is rather controversial.  Often split between two groups.

Group A will want the features that go along with the tracking, for example: having Google Now tell you when a package is scheduled to arrive just because you got an email about it.

Image from EFF

Image from EFF

Group B will be on the side of privacy for the sake of privacy.  They fear that all of these features are putting in place an infrastructure to be taken advantage of by bad actors, such as the implementers of the features themselves or even someone like the NSA.

I typically find myself in one camp for certain issues, and the other for well… others.

In Windows 10, I don’t use any of these features, such as Cortana.  So I’m perfectly happy to disable any kind of information sharing my computer and Microsoft are making use of.

Spybot Anti-Beacon

If you are like me and want to disable as much of the windows 10 tracking as you can, I recommend you check out Spybot Anti-Beacon.  It’s a tool that helps you disable the tracking features.

It also works for Windows versions going back to 7.

Description from their site:

Spybot Anti-Beacon is a standalone tool which was designed to block and stop the various tracking (telemetry) issues present in Windows 10. It has since been modified to block similar tracking functionality in Windows 7, Windows 8 and Windows 8.1 operating systems.

Check it out, it’s neat.

Get More Information from Windows Task Manager

Every once in a while I’ll find I need to force close a Java application.  So I open up the task manager in Windows, only to find…

java processesThe names are all the same, and the descriptions don’t help very much, either.  I can sometimes know based on the memory footprint, but that’s too much of a guess for me.

I don’t know about you, but I feel like I’ve murdered something innocent when I force close an application that was working just fine.

So the problem here is a lack of information, which we can rectify by going to “View | Select Columns…” and adding the column “Command Line”, which will display “The full command line specified to create the process.” – Quote Source

This will often give you enough added information to determine which application is represented by which process.

java processes - with command line

Quickly Navigate to a Package in “Package Explorer” in Eclipse

Often while working on a project, I will want to navigate to the same package that a class I’m inspecting is defined in.

I may want to get a better feel for what a class does / where it belongs, or want to add a new one in the same location, or various other reasons for wanting to do this.

The way I’ve always done this is the manual way.

“This class is defined in the ca.tu.horizon.consumer… ok ca – *click* – tu – *click* – horizon – *click* – consumer – *click*, there we go…”

However I just came across a very nice way of instantly getting there from within the hover tooltip that displays the package.  This is probably already known by most of you, and I’m a little mad at myself for taking so long to find this out, but you can just click on the package you want from within the tooltip!

1: In the hover tooltip, click on the package level you wish to navigate to

Package Nav 1

2: Click on the package icon

Package Nav 2

3: You’re brought to the corresponding package!

Package Nav 3