简体   繁体   English

通过Eclipse更改fitNesse端口

[英]Change fitNesse port through Eclipse

Using Eclipse, I have created a Fitnesse framework. 使用Eclipse,我创建了一个FitNesse的框架。 When I run the simple calculator example (Right Click - Run as java app) my console throws the error - 当我运行简单的计算器示例(右键点击 - 作为运行Java应用程序),我的控制台抛出错误 -

Starting FitNesse on port: 80 SEVERE: FitNesse cannot be started... SEVERE: Port 80 is already in use. 端口启动的FitNesse:80重度:FitNesse的无法启动...重度:80端口已在使用。 SEVERE: Use the -p command line argument to use a different port. 重度:使用-p命令行参数使用不同的端口。

I do not want to use the command line to manually change the default port. 我不想使用命令行来手动更改默认端口。 I want to change it through Eclipse? 我想通过Eclipse来改变它呢? How do I do this? 我该怎么做呢? I am new to this so please explain plainly. 我是新来这个,请解释清楚。

Many thanks, 非常感谢,

Within Eclipse, when you right click the project, to "Run as Java Application", that same dropdown has an option to "Run Configurations", choose this. 在Eclipse中,当您右键单击该项目时,要“以Java应用程序运行”,则在同一下拉菜单中可以选择“运行配置”,然后选择此选项。 In the pop up modal that will appear, we can enter -p port# as an argument. 在将出现的弹出模式中,我们可以输入-p port#作为参数。 Save and Close. 保存并关闭。 Now "Run as Java Application". 现在“以Java应用程序运行”。

you need to modify file bulid.gradle 您需要修改文件bulid.gradle

open the gradle file and find task run , set port 80 打开gradle文件并查找task run ,设置端口80

task run(type: JavaExec) {
    dependsOn classes, copyRuntimeLibs
    classpath = sourceSets.main.runtimeClasspath
    main "fitnesseMain.FitNesseMain"
    args "-p", "80", "-e", "0"
}

build fitnesse preject and run FitnesseMain 建立Fitnesse Preject并运行FitnesseMain

If you are using Maven rather gradle, try using antrun plugin and specify port number in the task args. 如果您正在使用Maven的gradle相当,尝试使用antrun插件,并在任务ARGS指定端口号。 Then, run start-fitnesse task 然后,运行start-fitnesse任务

<plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.6</version>
        <executions>
          <execution>
            <id>start-fitnesse</id>
            <phase>test</phase>
            <configuration>
              <tasks>
                <echo taskname="fitnesse" message="Starting FitNesse..." />
                <java classname="fitnesseMain.FitNesseMain" classpathref="maven.runtime.classpath"
                  fork="true">
                  <arg line="-p 49231" />
                  <arg line="-v " />
                  <arg line="-d ." />
                </java>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM