所以我有这个:
<%= link_to(image_tag(@model.picture.url(:thumb), :alt => ''), "/pages/you/#{something.id}", {:id => "y_link_#{something.id}"}) %>
Run Code Online (Sandbox Code Playgroud)
哪个有效,但我需要介于两者之间,如下所示:
<a id="y_link_2" href="/pages/you/2" class="">
<span>Apples</span>
<img src="another_small.jpg?1236340989" alt="">
</a>
Run Code Online (Sandbox Code Playgroud)
我该如何添加
<span>Apples</span>
Run Code Online (Sandbox Code Playgroud)
到了link_to?
我一直在寻找加速我的测试的方法,使用某种并行测试结合我目前的Guard设置.Guard-Hydra似乎是一个良好的开端,但Hydra宝石本身不再被维护,作者指导人们改为parallel_tests.
并行测试看起来非常好.我使用通常的rake任务在命令行工作,但我自己无法编写适当的后卫扩展.我一直对搜索'guard parallel_tests'时缺乏可用信息感到惊讶.当然,我不是唯一一个拥有多核PC的Rails开发人员,他们有兴趣加快测试速度吗?
我在〜/ .m2/settings.xml中有这个:
<servers>
<server>
<username>deployment</username>
<password>xxxxxx</password>
<id>central</id>
</server>
<server>
<username>deployment</username>
<password>xxxxxx</password>
<id>snapshots</id>
</server>
</servers>
Run Code Online (Sandbox Code Playgroud)
这在我的POM中:
<distributionManagement>
<repository>
<id>central</id>
<name>libs-release-local</name>
<url>http://repo.example.com:8081/nexus/content/repositories/libs-release-local</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>libs-local</name>
<url>http://repo.example.com:8081/nexus/content/repositories/libs-local</url>
</snapshotRepository>
</distributionManagement>
Run Code Online (Sandbox Code Playgroud)
我面临的问题是工件没有部署,nexus日志显示用于进行身份验证的用户名是"匿名的".这就是它失败的原因.为什么maven没有选择settings.xml中指定的用户名/密码,我做错了什么?
此外,我尝试使用-X运行maven,DEBUG日志说它正在读取设置的正确文件:
[DEBUG] Reading global settings from /home/praddy/apache-maven-3.0.5/conf/settings.xml
[DEBUG] Reading user settings from /home/praddy/.m2/settings.xml
[DEBUG] Using local repository at /home/praddy/.m2/repository
Run Code Online (Sandbox Code Playgroud) 所以,我一直想要使用Lombok一段时间 - 我终于开始了一个我可以使用它的项目.需要注意的重要一点是,这将是一个大型的企业级应用程序,因此使用的集成模式必须是有意义的,尽可能少的黑客攻击.
所以我看了一下lombok-maven-plugin和整个delombok软糖.我知道这将复制我的所有代码,并扩展现有的lombok注释.这给了我第二组生成的.java文件,这些文件需要在编译期间由maven使用.
但是,通过生成这些新的源文件 - eclipse会选择它们并尝试将它们引入我的项目中.因此,它会触发关于重复类的一百万(OK,轻微夸大)错误.
一些解决方案建议我改变<sourceDirectory>我的POM.这会让事情变得更好,因为mvn eclipse:eclipse现在src/main/java将从项目中完全省略我的java目录 - 只显示delombok进程的输出.
然后提出我需要使用一个配置文件来编译/打包项目,以及另一个配置文件mvn eclipse:eclipse.这不是一个可接受的解决方案,因为我不得不花费足够的时间来维护/解释我已经很复杂的maven设置 - 而不必引入一个全新的配置文件(除了我现有的配置文件).
我希望有一些灵感可以让我免于为我的项目写下Lombok.这是一个减少样板代码的好工具,但它似乎还没有为黄金时段的企业使用做好准备 - 我觉得非常令人失望:-(
以下是我目前的POM:
<build>
<sourceDirectory>target/generated-sources/delombok</sourceDirectory>
<testSourceDirectory>target/generated-test-sources/delombok</testSourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
<version>1.12.2.0</version>
<dependencies>
<dependency>
<groupId>sun.jdk</groupId>
<artifactId>tools</artifactId>
<version>1.7</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
<executions>
<execution>
<id>delombok</id>
<phase>generate-sources</phase>
<goals>
<goal>delombok</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<addOutputDirectory>false</addOutputDirectory>
<sourceDirectory>src/main/java</sourceDirectory>
</configuration>
</execution>
<execution>
<id>test-delombok</id>
<phase>generate-test-sources</phase>
<goals>
<goal>testDelombok</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<addOutputDirectory>false</addOutputDirectory>
<sourceDirectory>src/test/java</sourceDirectory>
</configuration> …Run Code Online (Sandbox Code Playgroud) 我花了太多时间在谷歌和Pentaho论坛上寻找一个简单的例子,我认为这是一个常见的用例.我要求SE人员帮忙回答这个问题.
我有一个Java和Pentaho ETL工作混合的项目.我们希望使用maven 3构建,测试和部署这两种类型的项目.
我正在寻找一个示例POM,它将在集成测试阶段执行转换和作业(使用kitchen/pan,我假设).此外,如果可能的话,还有一个示例,用于测试数据库中的水壶作业(例如DBunit).到目前为止,这是我所掌握的信息.
正在进行的工作POM文件:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pentaho-example</groupId>
<artifactId>pentaho-example</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>pentaho-example</name>
<!--
required by pentaho stuff to bring in the needed jars to run via
command line for testing
-->
<repositories>
<repository>
<releases>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<id>pentaho-repo</id>
<url>http://repo.pentaho.org/artifactory/pentaho/</url>
</repository>
<repository>
<id>pentaho-third-party</id>
<url>http://repo.pentaho.org/artifactory/third-party/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.7</version>
</dependency>
<dependency>
<groupId>org.pentaho</groupId>
<artifactId>core</artifactId>
<version>4.2.1</version>
</dependency>
</dependencies>
<build> …Run Code Online (Sandbox Code Playgroud) 我有一个显示按钮的显示按钮,JTable但表格不可见.注意:当我删除JScrollPane代码工作正常但没有显示表的标题,所以任何帮助请使这个代码正常工作而不删除JScrollPane
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
public class Training extends JFrame {
public Training() {
getContentPane().setLayout(new FlowLayout());
JTable table = new JTable();
table.setModel(new DefaultTableModel(new Object[][] { { "joe", "joe" },
{ "mickel", "mickel" }, }, new String[] { "LastName",
"FirstName" }));
final JScrollPane pane = new JScrollPane(table);
pane.setVisible(false);
getContentPane().add(pane);
JButton btn = new JButton("show");
add(btn);
btn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO …Run Code Online (Sandbox Code Playgroud) 我正在使用现有的独立pom.xml在已建立的代码库中工作.
目的是将一个名为"hive"的子项目合并到父项目的子目录中.注意:hive/pom.xml已经存在,并且它本身可以正常工作.
所以在父母的pom.xml中我添加了:
<modules>
<module>hive</module>
</modules>
Run Code Online (Sandbox Code Playgroud)
问题是我基本上失去了从父项目创建可部署jar的能力.
stephenb@gondolin:/shared/git2/etl$ mvn package assembly:single
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: com.myco.etl:etl
POM Location: /shared/git2/etl/pom.xml
Validation Messages:
[0] Packaging 'jar' is invalid. Aggregator projects require 'pom' as packaging.
Reason: Failed to validate POM for project com.myco.etl:etl at /shared/git2/etl/pom.xml
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Failed to validate POM for project com.myco.etl:etl at /shared/git2/etl/pom.xml
at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:404)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:272)
at …Run Code Online (Sandbox Code Playgroud) 我写了一个doclet来收集一些数据并将其传递给记者.我希望这位记者能够互换.我尝试使用additionalDependency和/或pluginDependency将一个报告器实现添加到doclet类路径.我无法使用Java 6服务加载器加载报告器实现,也无法使用doclet类加载器或线程上下文类加载器来获取类.
如何将test.TestReporterImpl导入test-doclet类路径?
在doclet中:
apiReporterServiceLoader = ServiceLoader.load(TestReporter.class); // test.TestReporter
apiReporterServiceLoader.iterator().hasNext(); // false
Thread.currentThread().getContextClassLoader().loadClass("test.TestReporterImpl"); // ClassNotFoundException
getClass().getClassLoader().loadClass("test.TestReporterImpl"); // ClassNotFoundException
Run Code Online (Sandbox Code Playgroud)
在执行doclet的pom中
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<executions>
<execution>
<id>run-my-doclet</id>
<goals>
<goal>javadoc</goal>
</goals>
<phase>generate-resources</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>test</groupId>
<artifactId>test-doclet-test-reporter</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<configuration>
<doclet>test.TestDoclet</doclet>
<docletArtifact>
<groupId>test</groupId>
<artifactId>test-doclet</artifactId>
<version>${project.version}</version>
</docletArtifact>
<additionalDependencies>
<additionalDependency>
<groupId>test</groupId>
<artifactId>test-doclet-test-reporter</artifactId>
<version>${project.version}</version>
</additionalDependency>
</additionalDependencies>
<useStandardDocletOptions>false</useStandardDocletOptions>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
测试的doclet - 测试 - 记者/ src目录/主/资源/ META-INF /服务/ test.TestReporter
test.TestReporterImpl
Run Code Online (Sandbox Code Playgroud) 我正在使用AngularJS + UI Bootstrap提供的"模态"指令.模态对话框效果很好,但我有一个问题:URL没有变化.
例如,我的AngularJS应用程序具有为"/ people"设置的路线,该路线显示人员列表.当用户点击某个人时,会出现一个模态对话框并显示详细信息.我试图弄清楚如何修改URL而不实际导致$ routeProvider重新执行控制器.
例如,我可以在我的路线中有类似的东西:
$routeProvider.
when('/people', {controller: PeopleCtrl, templateUrl: 'templates/people.html'}).
when('/people/:personId', {controller: PeopleCtrl, templateUrl: 'templates/people.html'}).
Run Code Online (Sandbox Code Playgroud)
然后在我的PeopleCtrl中我可以这样做:
if ($routeParams.personId) {
$scope.editPerson({id: $routeParams.personId});
}
Run Code Online (Sandbox Code Playgroud)
这基本上调用了我绑定的同一个函数,点击人行.这适用于允许我的应用程序响应像/ people/123这样的URL,但我无法弄清楚如何让URL从/ people跳转到/ people/123然后回到/ people作为模态对话框打开和关闭.
显然,我可以调用$ location.path("/ people"),但问题是PeopleCtrl得到重新启动,我想避免这种情况,因为应该保留模态"后面"的状态.
换句话说:我正在寻找一种方法来更改URL /位置,而不会检测到正常的$ routeProvider更改.
谢谢!
modal-dialog twitter-bootstrap angularjs angular-ui-bootstrap
我想以类似于gradle.properties或的方式在gradle中设置属性(例如来自settings.gradle)-D.可能吗?
以下代码演示了我正在尝试做什么,但它不起作用:
import org.gradle.internal.os.OperatingSystem
def getArchitecture() {
return System.getProperty("os.arch")
}
def getName() {
if(OperatingSystem.current().isMacOsX()) {
return "darwin"
} else if(OperatingSystem.current().isLinux()) {
return "linux"
} else {
throw Exception("The operating system you use is not supported.")
}
}
allprojects {
ext {
// this variable has to be visible from all the projects
// and .gradle files in the same way as if it was set
// from gradle.properties file
buildMachine = getName() + "_" + getArchitecture() …Run Code Online (Sandbox Code Playgroud)