Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to use setenv.bat with Atlassian SDK for JIRA?

Ben Duffin November 29, 2012

I've got a plugin, and I want to pass it some system properties. When developing locally with the Atlassian SDK, I am able the pass the properties via the --jvmargs parameter. Instead, I would like to set those properties in setenv.bat, but I'm not having much luck. I added a setenv.bat in the {plugin-folder}/target/container/tomcat6x/apache-tomcat-6.0.20/bin folder, but it doesn't seem to be recognized.

setenv.bat did not exist in the bin folder, but I found it in the bin folder of our dev environment, so I copied it over. The bin folder did contain catalina.bat, but it seems like that isn't being used either.

Any ideas would be appreciated.

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Carsten A.
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 1, 2012

Why do you want an external .bat file, when you can define all jvmargs in your pom?

<plugin>
    <groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>maven-jira-plugin</artifactId>
    <version>${atl.plugin.sdk.version}</version>
    <extensions>true</extensions>
    <configuration>
        <productVersion>${jira.version}</productVersion>
        <productDataVersion>${jira.data.version}</productDataVersion>
        <jvmArgs><!-- all your jvmArgs, e.g. -Xmx512m -XX:MaxPermSize=256m--></jvmArgs>
    </configuration>
</plugin>

Ben Duffin December 2, 2012

Good thought, that would be useful in many cases. But for my case, the values will be different in each environment, so I can't define them in the plugin itself.

Carsten A.
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 2, 2012

Sure you can. You can define a profile with it's respective settings for each environment.
http://maven.apache.org/guides/introduction/introduction-to-profiles.html

Ben Duffin December 2, 2012

Yeah, we can use a maven profile for local testing, while continuing to rely on the setenv file for our development and production environments (where we don't have issues using setenv).

I still think it could be advantageous to use catalina.bat and setenv.bat with the SDK for local testing, even if it isn't required for this particular circumstance. The files exist for a reason, and it would be a shame if nobody could use them with the SDK. Is it possible to instruct the SDK to run tomcat with these files? My specific issue has been resolved, but an answer for this question could be useful for other users.

Carsten A.
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 3, 2012

Hmm. I assume at least catalina.bat should be called since system.out logs the start of catalina. Within catalina.bat, setenv.bat is called (when found).

Do you have anything like "@echo" in your setenv.bat? Because I read somewhere, that this functions like a delimiter.

Ben Duffin December 3, 2012

Yeah, I would have figured the catalina.bat would be used. I had updated the first two lines in \target\container\tomcat6x\apache-tomcat-6.0.20\bin\catalina.bat to:

@echo on

echo Hello World

Then I started up again using atlas-debug.

This seems pretty simple, but Hello World is not being echoed anywhere. It seems like atlas-debug must be using some other scripts to start.

Carsten A.
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 3, 2012

I guess that's the problem here. The '@' character is used as a delimiter so everything gets messed up afterwards when called by maven. Erase '@echo on' and it should work (erase 'echo Hello World' after you confirmed functionality, too). System outputs shouldn't be used in those files - just environment settings.

Ben Duffin December 5, 2012

No luck. I removed "@echo on" and verified there were no other @ characters in the file. I'm still not seeing the output. Are you sure that it's not using a Catalina.bat from another location?

TAGS
AUG Leaders

Atlassian Community Events