本文使用的Linux系统为CentOS

2. apache服务的启动与关闭

# 启动服务
$ sudo systemctl start httpd.service

# 查看服务
$ ps aux | grep httpd
root     *  0.3  0.0 220444  4956 ?        Ss   15:46   0:00 /usr/sbin/httpd -DFOREGROUND
apache   *  0.0  0.0 220444  2492 ?        S    15:46   0:00 /usr/sbin/httpd -DFOREGROUND
apache   *  0.0  0.0 220444  2488 ?        S    15:46   0:00 /usr/sbin/httpd -DFOREGROUND
apache   *  0.0  0.0 220444  2488 ?        S    15:46   0:00 /usr/sbin/httpd -DFOREGROUND
apache   *  0.0  0.0 220444  2488 ?        S    15:46   0:00 /usr/sbin/httpd -DFOREGROUND
apache   *  0.0  0.0 220444  2488 ?        S    15:46   0:00 /usr/sbin/httpd -DFOREGROUND

# 停止服务
$ sudo systemctl stop httpd.service

# 重启服务
$ sudo systemctl restart httpd.service

启动服务后,可以在外网通过服务器的IP地址访问。可以看到如下界面:

4. 配置Tomcat

在启动Tomcat后,发现进入不了Manage APP,需要在Tomcat中配置用户名和密码,找到Tomcat目下的conf目录,编辑tomcat-users.xml,在<tomcat-users>标签下加入下面两行代码,即配置了Manage APP的用户名和密码为tomcat,tomcat:

<tomcat-users>
<role rolename="manager-gui"/>
<user username="tomcat" password="tomcat" roles="manager-gui"/>
</tomcat-users>

至此,Tomcat就在Mac下配置完成了,能启动关闭,当然也可以在Manage APP中发布应用,也可以直接将应用放到Tomcat下的webapps目录下。

注:当然可以把Tomcat配置在环境变量中,这个可以自行Google或百度。

图片 1

4.6 mvn eclipse:clean 清理eclipse项目的一些设置

$ mvn eclipse:clean
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-eclipse-plugin:2.10:clean (default-cli) @ demo ---
[INFO] Deleting file: .project
[INFO] Deleting file: .classpath
[INFO] Deleting file: .wtpmodules
[INFO] Deleting file: .settings
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.788 s
[INFO] Finished at: 2016-10-30T19:07:36+08:00
[INFO] Final Memory: 16M/309M
[INFO] ------------------------------------------------------------------------

3. 配置自己可以在外部访问的内容

可以在/var/www/html下创建一个软链接,链接到你想要在外部访问的内容,同时要修改要访问目录的权限。

$ sudo ln -s your_path/images /var/www/html
$ sudo chmod 755 images

注:需要确保images的所有父目录都有权限,同时images的路径应该是全路径。


0


0

查看评论

文章作者:Tyan 博客:noahsnail.com | CSDN | 简书 本文使用的Linux系统为CentOS 7,下面将介绍apache服务的启...

文章作者:Tyan
博客:noahsnail.com  |  CSDN  |  简书

import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import load_digits
from sklearn.cross_validation import train_test_split
from sklearn.svm import SVC
from sklearn.learning_curve import learning_curve
from sklearn.model_selection import cross_val_score 


# 加载数据集
digits = load_digits()
X = digits.data
y = digits.target
# 用SVM进行学习并记录loss
train_sizes, train_loss, test_loss = learning_curve(SVC(gamma = 0.001), 
                                                    X, y, cv = 10, scoring = 'neg_mean_squared_error',
                                                    train_sizes = [0.1, 0.25, 0.5, 0.75, 1])

# 训练误差均值
train_loss_mean = -np.mean(train_loss, axis = 1)
# 测试误差均值
test_loss_mean = -np.mean(test_loss, axis = 1)

# 绘制误差曲线
plt.plot(train_sizes, train_loss_mean, 'o-', color = 'r', label = 'Training')
plt.plot(train_sizes, test_loss_mean, 'o-', color = 'g', label = 'Cross-Validation')

plt.xlabel('Training data size')
plt.ylabel('Loss')
plt.legend(loc = 'best')
plt.show()

4. Maven命令

测试mvn命令的项目为Spring Boot项目,项目创建参考我的文章:Spring Boot 2.0.0参考手册_中英文对照_Part II_11-12

链接为:CSND | 简书 | 个人博客

Linux下启动和停止apache服务,linuxapache

文章作者:Tyan
博客:noahsnail.com  |  CSDN  |  简书

本文使用的Linux系统为CentOS 7,下面将介绍apache服务的启动、关闭与设置。apache在CentOS 7中一般是默认安装的,而且服务名字为httpd

1. 下载Tomcat并解压

  • 首先下载Tomcat,这不必多说,下载地址为:http://tomcat.apache.org/

  • 解压Tomcat,例如作者下载的apache-tomcat-7.0.70.zip,直接解压即可,解压后得到apache-tomcat-7.0.70文件夹。

文章作者:Tyan
博客:noahsnail.com | CSDN | 简书

4.5 mvn test-compile 编译测试文件

$ mvn test-compile
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ demo ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/***/demo/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ demo ---
[INFO] Nothing to compile - all classes are up to date
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.735 s
[INFO] Finished at: 2016-10-30T18:41:12+08:00
[INFO] Final Memory: 15M/309M
[INFO] ------------------------------------------------------------------------

1. 安装apache及查看相关配置

# apache安装命令

$ sudo yum install httpd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Package httpd-2.4.6-45.el7.centos.4.x86_64 already installed and latest version
Nothing to do


# 查看apache文件的位置

$ sudo find / -name httpd
/run/httpd
/etc/logrotate.d/httpd
/etc/sysconfig/httpd
/etc/httpd
/var/log/httpd
/var/cache/httpd
/usr/sbin/httpd
/usr/lib64/httpd
/usr/share/httpd
/usr/include/httpd
/usr/libexec/initscripts/legacy-actions/httpd

Apache配置文件位于/etc/httpd/conf,主要的配置文件是/etc/httpd/conf/httpd.conf, apache相关的配置信息都可以在这个文件中看到。

2. 启动Tomcat的相关配置

首先需要给Tomcat的bin目录下的sh文件赋予可执行权限,命令如下:

$ sudo chmod 755 ~/MyEclipse/apache-tomcat-7.0.70/bin/*.sh
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import load_digits
from sklearn.cross_validation import train_test_split
from sklearn.svm import SVC
from sklearn.learning_curve import learning_curve
from sklearn.model_selection import cross_val_score 


# 加载数据集
digits = load_digits()
X = digits.data
y = digits.target
# 用SVM进行学习并记录loss
train_sizes, train_loss, test_loss = learning_curve(SVC(gamma = 0.001), 
                                                    X, y, cv = 10, scoring = 'neg_mean_squared_error',
                                                    train_sizes = [0.1, 0.25, 0.5, 0.75, 1])

# 训练误差均值
train_loss_mean = -np.mean(train_loss, axis = 1)
# 测试误差均值
test_loss_mean = -np.mean(test_loss, axis = 1)

# 绘制误差曲线
plt.plot(train_sizes, train_loss_mean, 'o-', color = 'r', label = 'Training')
plt.plot(train_sizes, test_loss_mean, 'o-', color = 'g', label = 'Cross-Validation')

plt.xlabel('Training data size')
plt.ylabel('Loss')
plt.legend(loc = 'best')
plt.show()

4.1 mvn compile 编译项目,编译的内容在target目录(默认)

$ mvn compile
[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/1.4.1.RELEASE/spring-boot-starter-parent-1.4.1.RELEASE.pom
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/1.4.1.RELEASE/spring-boot-starter-parent-1.4.1.RELEASE.pom (8 KB at 2.1 KB/sec)
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-web/1.4.1.RELEASE/spring-boot-starter-web-1.4.1.RELEASE.pom
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-web/1.4.1.RELEASE/spring-boot-starter-web-1.4.1.RELEASE.pom (2 KB at 2.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starters/1.4.1.RELEASE/spring-boot-starters-1.4.1.RELEASE.pom
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starters/1.4.1.RELEASE/spring-boot-starters-1.4.1.RELEASE.pom (7 KB at 9.1 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter/1.4.1.RELEASE/spring-boot-starter-1.4.1.RELEASE.pom
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter/1.4.1.RELEASE/spring-boot-starter-1.4.1.RELEASE.pom (2 KB at 2.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot/1.4.1.RELEASE/spring-boot-1.4.1.RELEASE.pom
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot/1.4.1.RELEASE/spring-boot-1.4.1.RELEASE.pom (10 KB at 12.2 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-autoconfigure/1.4.1.RELEASE/spring-boot-autoconfigure-1.4.1.RELEASE.pom
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-autoconfigure/1.4.1.RELEASE/spring-boot-autoconfigure-1.4.1.RELEASE.pom (20 KB at 16.3 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-logging/1.4.1.RELEASE/spring-boot-starter-logging-1.4.1.RELEASE.pom
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-logging/1.4.1.RELEASE/spring-boot-starter-logging-1.4.1.RELEASE.pom (2 KB at 0.7 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-tomcat/1.4.1.RELEASE/spring-boot-starter-tomcat-1.4.1.RELEASE.pom
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-tomcat/1.4.1.RELEASE/spring-boot-starter-tomcat-1.4.1.RELEASE.pom (2 KB at 1.8 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-test/1.4.1.RELEASE/spring-boot-starter-test-1.4.1.RELEASE.pom
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-test/1.4.1.RELEASE/spring-boot-starter-test-1.4.1.RELEASE.pom (4 KB at 2.5 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-test/1.4.1.RELEASE/spring-boot-test-1.4.1.RELEASE.pom
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-test/1.4.1.RELEASE/spring-boot-test-1.4.1.RELEASE.pom (5 KB at 2.5 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-test-autoconfigure/1.4.1.RELEASE/spring-boot-test-autoconfigure-1.4.1.RELEASE.pom
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-test-autoconfigure/1.4.1.RELEASE/spring-boot-test-autoconfigure-1.4.1.RELEASE.pom (6 KB at 3.8 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-web/1.4.1.RELEASE/spring-boot-starter-web-1.4.1.RELEASE.jar
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter/1.4.1.RELEASE/spring-boot-starter-1.4.1.RELEASE.jar
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot/1.4.1.RELEASE/spring-boot-1.4.1.RELEASE.jar
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-autoconfigure/1.4.1.RELEASE/spring-boot-autoconfigure-1.4.1.RELEASE.jar
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-logging/1.4.1.RELEASE/spring-boot-starter-logging-1.4.1.RELEASE.jar
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-web/1.4.1.RELEASE/spring-boot-starter-web-1.4.1.RELEASE.jar (3 KB at 3.3 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-tomcat/1.4.1.RELEASE/spring-boot-starter-tomcat-1.4.1.RELEASE.jar
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-tomcat/1.4.1.RELEASE/spring-boot-starter-tomcat-1.4.1.RELEASE.jar (3 KB at 1.6 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter/1.4.1.RELEASE/spring-boot-starter-1.4.1.RELEASE.jar (3 KB at 1.1 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-logging/1.4.1.RELEASE/spring-boot-starter-logging-1.4.1.RELEASE.jar (3 KB at 0.9 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot/1.4.1.RELEASE/spring-boot-1.4.1.RELEASE.jar (642 KB at 29.2 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-autoconfigure/1.4.1.RELEASE/spring-boot-autoconfigure-1.4.1.RELEASE.jar (946 KB at 37.0 KB/sec)
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ demo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/***/demo/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 41.975 s
[INFO] Finished at: 2016-10-30T18:27:22+08:00
[INFO] Final Memory: 23M/156M
[INFO] ------------------------------------------------------------------------

3. 启动和关闭Tomcat

启动和关闭Tomcat,即运行startup.sh,shutdown.sh文件有两种方式,命令如下:

  • 方法一:
# 启动Tomcat
$ cd MyEclipse/apache-tomcat-7.0.70/bin/
$ sh startup.sh
Using CATALINA_BASE:   /Users/***/MyEclipse/apache-tomcat-7.0.70
Using CATALINA_HOME:   /Users/***/MyEclipse/apache-tomcat-7.0.70
Using CATALINA_TMPDIR: /Users/***/MyEclipse/apache-tomcat-7.0.70/temp
Using JRE_HOME:        /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
Using CLASSPATH:       /Users/***/MyEclipse/apache-tomcat-7.0.70/bin/bootstrap.jar:/Users/***/MyEclipse/apache-tomcat-7.0.70/bin/tomcat-juli.jar
Tomcat started.

# 关闭Tomcat
$ sh shutdown.sh
Using CATALINA_BASE:   /Users/***/MyEclipse/apache-tomcat-7.0.70
Using CATALINA_HOME:   /Users/***/MyEclipse/apache-tomcat-7.0.70
Using CATALINA_TMPDIR: /Users/***/MyEclipse/apache-tomcat-7.0.70/temp
Using JRE_HOME:        /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
Using CLASSPATH:       /Users/***/MyEclipse/apache-tomcat-7.0.70/bin/bootstrap.jar:/Users/***/MyEclipse/apache-tomcat-7.0.70/bin/tomcat-juli.jar
  • 方法二:
# 启动Tomcat
$ ./startup.sh start
Using CATALINA_BASE:   /Users/***/MyEclipse/apache-tomcat-7.0.70
Using CATALINA_HOME:   /Users/***/MyEclipse/apache-tomcat-7.0.70
Using CATALINA_TMPDIR: /Users/***/MyEclipse/apache-tomcat-7.0.70/temp
Using JRE_HOME:        /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
Using CLASSPATH:       /Users/***/MyEclipse/apache-tomcat-7.0.70/bin/bootstrap.jar:/Users/***/MyEclipse/apache-tomcat-7.0.70/bin/tomcat-juli.jar
Tomcat started.

# 关闭Tomcat
$ ./shutdown.sh shutdown
Using CATALINA_BASE:   /Users/***/MyEclipse/apache-tomcat-7.0.70
Using CATALINA_HOME:   /Users/***/MyEclipse/apache-tomcat-7.0.70
Using CATALINA_TMPDIR: /Users/***/MyEclipse/apache-tomcat-7.0.70/temp
Using JRE_HOME:        /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
Using CLASSPATH:       /Users/***/MyEclipse/apache-tomcat-7.0.70/bin/bootstrap.jar:/Users/***/MyEclipse/apache-tomcat-7.0.70/bin/tomcat-juli.jar
usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ]  { -help | start | stop }
  • Demo

4.6 mvn eclipse:eclipse 生成eclipse项目,mvn idea:idea 生成IntelliJ IDEA项目

$ mvn eclipse:eclipse
[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-antrun-plugin/1.8/maven-antrun-plugin-1.8.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-antrun-plugin/1.8/maven-antrun-plugin-1.8.pom (4 KB at 1.3 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-antrun-plugin/1.8/maven-antrun-plugin-1.8.jar
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-antrun-plugin/1.8/maven-antrun-plugin-1.8.jar (36 KB at 28.3 KB/sec)
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-eclipse-plugin:2.10:eclipse (default-cli) > generate-resources @ demo >>>
[INFO] 
[INFO] <<< maven-eclipse-plugin:2.10:eclipse (default-cli) < generate-resources @ demo <<<
[INFO] 
[INFO] --- maven-eclipse-plugin:2.10:eclipse (default-cli) @ demo ---
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-provider-api/2.1/wagon-provider-api-2.1.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-provider-api/2.1/wagon-provider-api-2.1.pom (2 KB at 2.2 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon/2.1/wagon-2.1.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon/2.1/wagon-2.1.pom (16 KB at 18.9 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.6.3/plexus-archiver-2.6.3.pom
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.6.3/plexus-archiver-2.6.3.pom (4 KB at 4.2 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.18/plexus-utils-3.0.18.pom
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.18/plexus-utils-3.0.18.pom (4 KB at 4.5 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-io/2.1.3/plexus-io-2.1.3.pom
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-io/2.1.3/plexus-io-2.1.3.pom (3 KB at 1.7 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.pom (12 KB at 13.7 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interactivity-jline/1.0-alpha-5/plexus-interactivity-jline-1.0-alpha-5.pom
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interactivity-jline/1.0-alpha-5/plexus-interactivity-jline-1.0-alpha-5.pom (772 B at 0.9 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interactivity/1.0-alpha-5/plexus-interactivity-1.0-alpha-5.pom
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interactivity/1.0-alpha-5/plexus-interactivity-1.0-alpha-5.pom (482 B at 0.7 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-components/1.1.4/plexus-components-1.1.4.pom
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-components/1.1.4/plexus-components-1.1.4.pom (3 KB at 2.4 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/jline/jline/0.9.1/jline-0.9.1.pom
Downloaded: https://repo.maven.apache.org/maven2/jline/jline/0.9.1/jline-0.9.1.pom (145 B at 0.2 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-5/plexus-interactivity-api-1.0-alpha-5.pom
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-5/plexus-interactivity-api-1.0-alpha-5.pom (430 B at 0.6 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-resources/1.0-alpha-7/plexus-resources-1.0-alpha-7.pom
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-resources/1.0-alpha-7/plexus-resources-1.0-alpha-7.pom (2 KB at 2.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-components/1.1.17/plexus-components-1.1.17.pom
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-components/1.1.17/plexus-components-1.1.17.pom (0 B at 0.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/biz/aQute/bndlib/0.0.145/bndlib-0.0.145.pom
Downloaded: https://repo.maven.apache.org/maven2/biz/aQute/bndlib/0.0.145/bndlib-0.0.145.pom (0 B at 0.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-osgi/0.2.0/maven-osgi-0.2.0.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-osgi/0.2.0/maven-osgi-0.2.0.pom (2 KB at 2.4 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/biz/aQute/bndlib/0.0.203/bndlib-0.0.203.pom
Downloaded: https://repo.maven.apache.org/maven2/biz/aQute/bndlib/0.0.203/bndlib-0.0.203.pom (886 B at 1.1 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/eclipse/core/resources/3.3.0-v20070604/resources-3.3.0-v20070604.pom
Downloaded: https://repo.maven.apache.org/maven2/org/eclipse/core/resources/3.3.0-v20070604/resources-3.3.0-v20070604.pom (2 KB at 1.3 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-provider-api/2.1/wagon-provider-api-2.1.jar
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.6.3/plexus-archiver-2.6.3.jar
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-io/2.1.3/plexus-io-2.1.3.jar
Downloading: https://repo.maven.apache.org/maven2/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interactivity-jline/1.0-alpha-5/plexus-interactivity-jline-1.0-alpha-5.jar
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interactivity-jline/1.0-alpha-5/plexus-interactivity-jline-1.0-alpha-5.jar (6 KB at 2.8 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/jline/jline/0.9.1/jline-0.9.1.jar
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-io/2.1.3/plexus-io-2.1.3.jar (65 KB at 17.0 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-resources/1.0-alpha-7/plexus-resources-1.0-alpha-7.jar
Downloaded: https://repo.maven.apache.org/maven2/jline/jline/0.9.1/jline-0.9.1.jar (46 KB at 10.8 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.6.3/plexus-archiver-2.6.3.jar (129 KB at 30.7 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/biz/aQute/bndlib/0.0.145/bndlib-0.0.145.jar
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-osgi/0.2.0/maven-osgi-0.2.0.jar
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-osgi/0.2.0/maven-osgi-0.2.0.jar (13 KB at 2.1 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/eclipse/core/resources/3.3.0-v20070604/resources-3.3.0-v20070604.jar
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-resources/1.0-alpha-7/plexus-resources-1.0-alpha-7.jar (23 KB at 3.5 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-provider-api/2.1/wagon-provider-api-2.1.jar (51 KB at 7.2 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/biz/aQute/bndlib/0.0.145/bndlib-0.0.145.jar (112 KB at 13.4 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar (357 KB at 24.9 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/eclipse/core/resources/3.3.0-v20070604/resources-3.3.0-v20070604.jar (663 KB at 25.1 KB/sec)
[INFO] Using Eclipse Workspace: /Users/***
[INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAINER
[INFO] Resource directory's path matches an existing source directory but "test", "filtering" or "output" were different.The resulting eclipse configuration may not accurately reflect the project configuration for src/main/resources
[INFO] Not writing settings - defaults suffice
[INFO] Wrote Eclipse project for "demo" to /Users/***/demo.
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45.142 s
[INFO] Finished at: 2016-10-30T18:43:55+08:00
[INFO] Final Memory: 20M/328M
[INFO] ------------------------------------------------------------------------

本文主要介绍scikit-learn中的交叉验证。

5. Maven settings.xml

settings.xml是Maven最重要的配置文件,它通常位于两个位置:

  • Maven安装的主目录: $MAVEN_HOME/conf/settings.xml

  • 用户主目录: $USER_HOME/.m2/settings.xml

第一个setting.xml称为全局配置文件,第二个称为用户配置。如果两个文件同时存在,它们的内容将会合并,用户配置将会覆盖全局配置。

下面的内容翻译自Maven安装时的settings.xml文件:

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <!--设置本地仓库存储路径。默认路径为${user.home}/.m2/repository。 -->
  <localRepository>${user.home}/.m2/repository</localRepository>

  <!--设置用户输入时是Maven是否进行交互。如果设置为false,对于问题的参数Maven会使用一个合理的默认值,也可能是基于其它设置的。默认值为true。-->
  <interactiveMode>true</interactiveMode>

  <!--设置Maven执行build时是否连接网络。这会影响工件的下载,部署和其它。默认值为false(联网)。 -->
  <offline>false</offline>

  <!-- 
    这是一个组标识符列表,当通过插件的前缀解析插件时会搜索这个列表,例如,调用命令行"mvn prefix:goal"时。如果没有包含在这个列表里,Maven会自动的添加组标识符"org.apache.maven.plugins" 和"org.codehaus.mojo"。 这个元素包括一系列的pluginGroup元素,每一个子元素都包含一个groupId。当一个插件被使用,并且没有在命令行上提供的时候,插件组列表就会被查找。
  -->
  <pluginGroups>
    <!-- 指定插件查找的组标识符 -->
    <pluginGroup>com.your.plugins</pluginGroup>
  </pluginGroups>

  <!-- 设置本机连接网络的代理服务器列表。除非另外规定(系统属性或命令行转换),否则将激活并使用列表中的第一个代理。-->
  <proxies>
    <!-- 配置代理服务器的相关参数 -->
    <!-- 协议://主机名:端口 -->
    <!-- 用户名-密码 -->
    <proxy>
      <!-- 代理标识符,用来区分代理。 -->
      <id>optional</id>
      <!-- 指定是否激活 -->
      <active>true</active>
      <!-- 指定代理协议 -->
      <protocol>http</protocol>
      <!-- 指定代理认证的用户名 -->
      <username>username</username>
      <!-- 指定代理认证的密码 -->
      <password>pwd</password>
      <!-- 指定代理服务器的主机名 -->
      <host>proxy.host.net</host>
      <!-- 指定代理服务的端口 -->
      <port>80</port>
      <!-- 指定不被代理的主机名列表。多个用|分隔。-->
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
  </proxies>

  <!-- 
    当连接一个特定的服务器时,指定要使用的认证信息,在系统内部通过唯一的名字来标识(引用下面的id属性),你该指定username/password或privateKey/passphrase,它们是成对使用的。
  -->
  <servers>
    <!-- 例子一 用户名/密码-->
    <server>
      <!-- server的id(注意不是用户登陆的id)。该id与distributionManagement中repository元素的id必须要匹配。-->
      <id>deploymentRepo</id>
      <!-- 服务器认证的用户名 -->
      <username>repouser</username>
      <!-- 服务器认证的用户对应的密码 -->
      <password>repopwd</password>
    </server>

    <!-- 例子二 私钥/密码 -->
    <server>
      <id>siteServer</id>
      <!-- 认证用的私钥文件 -->
      <privateKey>/path/to/private/key<</privateKey>
      <!-- 认证用的私钥密码,没有密码就为空 -->
      <passphrase>optional;leave empty if not used.</passphrase>
    </server>
  </servers>

  <!-- 
    这是用来从远端仓库下载artifact的镜像列表。它的机制类似于这一:POM文件可能在解析特定的artifacts时会声明一个仓库。但这个仓库可能有时会有拥堵问题,因此必须在其它的几个地方放置几个它的镜像。 仓库定义会有唯一的id,因此我们可以为仓库创建一个镜像引用,用来作为一个可替代的下载地址。镜像站点将首选服务器的仓库
  -->
  <mirrors>
    <!-- 
      指定要使用的仓库镜像站点来代替给定的仓库,镜像服务仓库有一个ID来对应镜像的mirrorOf元素。ID是用来继承和查找用的,在整个镜像集合中必须是唯一的。 
    -->
    <mirror>
      <!--镜像的唯一标识符,用来区分不同的mirror元素。 -->
      <id>mirrorId</id>
      <!--被镜像的服务器的id,比如:central,不能和id匹配。-->
      <mirrorOf>repositoryId</mirrorOf>
      <!-- 镜像名称 -->
      <name>Human Readable Name for this Mirror</name>
       <!--镜像的URL。构建系统会优先使用该URL,而不是默认的服务器URL。 -->
      <url>http://my.repository.com/repo/path</url>
    </mirror>
  </mirrors>

  <!-- 
      这是一个可以用许多方式激活的配置文件列表,在这里可以修改构建过程。settings.xml中提供的配置信息是用来提供本地特定机器路径和仓库位置的,
      这允许在本地环境中进行构建工作。例如,你有一个集成测试插件,假设为cactus,它需要知道Tomcat的安装地址,你可以在这提供一个变量,在构建过程中配置cactus插件时这个变量可以被间接引用。正如上面所提到的,可以通过许多方式来激活配置文件,一种方式是通过文档中(settings.xml)中的activeProfiles部分来激活,后面会进行讨论。另一种方式本质上是依赖系统属性的检测,通过匹配属性中的一个特定值或检测其是否存在。配置文件也可以通过JDK版本前缀激活,当在JDK 1.4.2_07版本上执行构建时,值1.4可以激活一个配置文件。最后,配置文件列表可以直接在命令行中指定。
      注意:对于在settings.xml文件中定义的配置文件,你只能指定工件仓库,插件仓库,自由形式的属性作为POM文件中插件配置的变量。
  -->
  <profiles>
    <!-- 
        指定构建过程的一系列介绍,通过上面描述的一种或多种机制来激活。对于继承,可以通过<activatedProfiles/>或命令行来激活配置文件,配置文件必须有一个唯一的ID。
        配置文件识别的最佳实践是在配置文件中使用一致的命名约定。例如'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett'等等。这样可以更直观的理解引入的配置文件要实现什么,尤其是在调试时只有一系列配置文件的id的情况下。
        这个配置文件例子使用JDK版本来触发激活,并提供JDK特定的仓库。
    -->
    <profile>

      <id>jdk-1.4</id>

      <activation>
        <jdk>1.4</jdk>
      </activation>

      <repositories>
        <repository>
          <id>jdk14</id>
          <name>Repository for JDK 1.4 builds</name>
          <url>http://www.myhost.com/maven/jdk14</url>
          <layout>default</layout>
          <snapshotPolicy>always</snapshotPolicy>
        </repository>
      </repositories>
    </profile>

    <profile>
      <!-- 配置文件的唯一标识 -->
      <id>test</id>
      <!-- 远程仓库列表 -->
      <repositories>
        <!-- 远程仓库的配置信息 -->
        <repository>
          <!-- 远程仓库唯一标识-->
          <id>maven</id>
          <!-- 远程仓库名称 -->
          <name>maven for practice</name>
          <!-- 远程仓库URL -->
          <url>http://127.0.0.1/test</url>
          <layout>default</layout>
          <releases>
            <!--是否使用这个资源库下载这种类型的构件 默认值:true-->
            <enabled>true</enabled>
            <!--指定下载更新的频率。值为:always,daily(默认),interval:X(X指分钟),never。 -->
            <updatePolicy>never</updatePolicy>
            <!--当Maven验证构件校验文件失败时该做什么fail或warn。-->
            <checksumPolicy>warn</checksumPolicy>
          </releases>
          <snapshots>
            <!--是否使用这个资源库下载-SNAPSHOT工件,默认为true-->
            <enabled>true</enabled>
            <!--指定下载更新的频率。这里的选项是:always,daily(默认),interval:X(X指分钟),never。 -->
            <updatePolicy>daily</updatePolicy>
            <!--当Maven验证构件校验文件失败时该怎么做fail或warn。-->
            <checksumPolicy>warn</checksumPolicy>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>maven</id>
          <name>maven test</name>
          <url>http://127.0.0.1/</url>
          <layout>default</layout>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>

  </profiles>

  <!-- 指定所有构建都激活的配置文件列表-->
  <activeProfiles>
    <activeProfile>repo-dev</activeProfile>
  </activeProfiles>
</settings>

本文由必威发布于必威-运维,转载请注明出处:本文使用的Linux系统为CentOS

TAG标签:
Ctrl+D 将本页面保存为书签,全面了解最新资讯,方便快捷。